#!/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);
#!/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);