module JSON::OnSteroids::InPlace

Direct including types

Defined in:

json_on_steroids/in_place.cr

Instance Method Summary

Instance Method Detail

def delete(key : Int | String | Nil) #

[View source]
def delete #

[View source]
def set(value) #

[View source]
def set(&) #

Mutate in place a value.

Example:

  # increment by one a visitor counter
  json.dig("data.visitors.count").set(&.as_i.+(1))

Other example:

 json["some"]["array"].as_arr.each{ |x| x.set("Hellow #{x.to_s}") }

Any authorized value can be passed (see JSON::Any::Mutable::AuthorizedSetTypes)


[View source]