alimanam3386 Active Member Licensed User Longtime User Jun 20, 2017 #1 Hi guys How can I create like bellow json format by map obj and json lib ? Code: Copy { "count": 3 , "result" : 200, "message": "OK", "data": [ {"id": 1 , "name": "A" , "family": "AA"}, {"id": 2 , "name": "B" , "family": "BB"} , {"id": 3 , "name": "C" , "family": "CC"} ] }
Hi guys How can I create like bellow json format by map obj and json lib ? Code: Copy { "count": 3 , "result" : 200, "message": "OK", "data": [ {"id": 1 , "name": "A" , "family": "AA"}, {"id": 2 , "name": "B" , "family": "BB"} , {"id": 3 , "name": "C" , "family": "CC"} ] }
eurojam Well-Known Member Licensed User Longtime User Jun 21, 2017 #2 paste your json here: http://basic4ppc.com:51042/json/index.html will produce your code.... Upvote 0
alimanam3386 Active Member Licensed User Longtime User Jun 21, 2017 #3 Thank you eurojam , I want to create json string like json that I showed in my first post. I know this link but I dont have json format yet ! I want create it first and after that I can use your link Upvote 0
Thank you eurojam , I want to create json string like json that I showed in my first post. I know this link but I dont have json format yet ! I want create it first and after that I can use your link
eurojam Well-Known Member Licensed User Longtime User Jun 21, 2017 #4 will be something like (not tested, only written down...): Code: Copy Dim jsonmap As Map Dim dataList As List Dim cols As Map jsonmap.Initialize dataList.Initialize Dim maxi = 5 For i = 0 To maxi cols.Initialize cols.Put("name", "N"&i) cols.Put("id", i) cols.Put("family", "CC") dataList.Add(cols) Next jsonmap.put("data", dataList) jsonmap.put("count", maxi) jsonmap.Put("message", "OK") Dim parser As JSONGenerator parser.Initialize(jsonmap) Log(parser.ToString) Upvote 0
will be something like (not tested, only written down...): Code: Copy Dim jsonmap As Map Dim dataList As List Dim cols As Map jsonmap.Initialize dataList.Initialize Dim maxi = 5 For i = 0 To maxi cols.Initialize cols.Put("name", "N"&i) cols.Put("id", i) cols.Put("family", "CC") dataList.Add(cols) Next jsonmap.put("data", dataList) jsonmap.put("count", maxi) jsonmap.Put("message", "OK") Dim parser As JSONGenerator parser.Initialize(jsonmap) Log(parser.ToString)