AndroidアプリでGSON Googleライブラリを使用して、以下で説明するようにJson文字列を作成する方法について、誰かがコードを手伝ってくれませんか。
以下のように JsonStringer を使用して、以下の文字列を生成しました。
JSONStringer stringer = new JSONStringer()
.object()
.key("loginRequest")
.object()
.key("UserId").value("007")
.key("Password").value("125987563")
.key("LicenseKey").value("My Project Key")
.key("MobileId").value("This is mobile id")
.endObject()
.endObject();
{"loginRequest":{"UserId":"007","Password":"125987563","LicenseKey":"This is License Key","MobileId":"This is mobile id"}}
Gsonを使用して上記の文字列を生成するにはどうすればよいかアドバイスしてください。
ありがとう