space=(string)
[permalink][rdoc]JSON 形式の文字列のトークン間に挿入する文字列をセットします。
require "json"
json_state = JSON::State.new(space: "")
json_state.space # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
json_state.space = "\t"
json_state.space # => "\t"
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name": "tanaka","age": 19}]