#2929 Writing json via JsonOutStream with nested [Str:Obj?]

james gessel Yesterday

Hi folks, I'm a beginner here, so sorry for the dumb questions and thanks in advance for the patience.

I'm writing a script that builds a json and writes it to a file. It all works except for any nested [Str:Obj?] objects are not handled properly by the json writer. Is there something special I need to do?

What I have is essentially

[
 [
   "name":"foo",
   "type":"class",
   "methods":[
    [
      "name":"bar",
      "type":"method"
    ],
    [
      "name":"bar",
      "type":"method"
    ]
 ],
]

Any top level objects are handled correctly (class in this case), but none of the nested methods are.

I'm using the following to write the file

myObj:= ...
json:= util::JsonOutStream(File("myFile.json".toUri))
json.writeJson(myObj).close

Login or Signup to reply.