How to nest objects when building JSON with JSONObject

前端 未结 4 1995
梦如初夏
梦如初夏 2021-02-07 20:34

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:34

    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.

提交回复
热议问题