开发者

how to map Json data into java beans?

开发者 https://www.devze.com 2023-03-25 12:01 出处:网络
i have some JSON data from server and i want to make java beans out of it. can anybody help? \"recent_data\":{[

i have some JSON data from server and i want to make java beans out of it. can anybody help?

"recent_data":{[            
                            "data_number":<data NUMBER>,
                             "bill_number":"<B开发者_如何学编程ILLING  NUMBER>"
                             "data_date":"<data DATE>",
                             "due_date":"<DUE DATE>",

                           "data_amount":{ 
                           "amount_exchanged":"<AMOUNT EXCHANGED>"
                           "amount_deducted":"<AMOUNT  DEDUCTED>",
                            "amount":"<AMOUNT>"
                            },
                           "total_amount":"TOTAL AMOUNT>",
                           "total_discounts":"<TOTAL_ DISCOUNTS>",
                            "adjusted_amount":"<ADJUSTED AMOUNT>",
                            "data_type":"Normal",
                            "data_status":"Open"
                 ]}


You can use JSONObject to parse your json string and to populate java beans if you want that (or you could work directly with JSONObject.

It is a bit verbose, but it's built in in android.


Try Gson, it works better than JSONObject library.

0

精彩评论

暂无评论...
验证码 换一张
取 消