nesting too deep in JSON… should I switch to XML?

后端 未结 2 1053
渐次进展
渐次进展 2021-01-19 23:56

I am getting a JSONException complaining about a very deep nesting (more than 30). I know that the value is hardcoded in JSONWriter. what best can I do? use another library

相关标签:
2条回答
  • 2021-01-20 00:04

    You may ask yourself if such a deep nesting makes sense at all. Is it really needed? Maybe you could give us an example why you'd need such a deep nesting.

    0 讨论(0)
  • 2021-01-20 00:21

    You don't say which JSON package you are using. It sounds like a defective one (org.json's default one? I almost wish it didn't exist) -- 30 is peanuts, absolutely should not cause problems. If you had thousands I could see why it could lead to problems, but 30 should be no problem. So consider switching the lib; usually you have many other issues if you hit into simple ones early on.

    0 讨论(0)
提交回复
热议问题