How to nest objects when building JSON with JSONObject

前端 未结 4 673
你的背包
你的背包 2021-02-07 20:52

I\'m trying to encode this string for a POST request. Can anyone tell me how I can encode

{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetSources\",         


        
4条回答
  •  抹茶落季
    2021-02-07 21:39

    You have two choices. You can create another object that holds "media":"music" and then put that in the original JSONObject or you can just pass this whole string into the JSONObject constructor and have it parse it for you.

提交回复
热议问题