1234567891011121314 |
- #!/usr/bin/ruby
- var json = require('JSON::PP').new;
- # Parse JSON
- var data = json.decode('{"blue": [1, 2], "ocean": "water"}');
- say data;
- # Change JSON
- data{:ocean} = Hash.new(water => %w[fishy salty]);
- # Encode JSON
- say json.encode(data);
|