fork download
  1. require "json"
  2.  
  3. $stdout.write JSON.generate(
  4. {"a" => [0,1,2]},
  5. {
  6. :space => " ",
  7. :indent => " ",
  8. :object_nl => "\n",
  9. :array_nl => "\n",
  10. })
  11.  
  12. p "0\n1"
  13.  
Success #stdin #stdout 0.02s 8068KB
stdin
Standard input is empty
stdout
{
  "a": [
    0,
    1,
    2
  ]
}"0\n1"