skip to Main Content

Json – Set int64 value to *int64 pointer

I need map the struct to create a JSON structure. The collector_id attribute in JSON should be able to take null value or int value. I hace the follow code: type purchaseInfo struct { CollectorID *int64 `json:"collector_id"` } func mapPurchaseInfo(collectorID…

VIEW QUESTION

Better way of writing validation for a JSON String

I have a JSON String: { "productName": "Gold", "offerStartDate": "01152023", "offerEndDate": "01152024", "offerAttributes": [ { "id": "TGH-DAD3KVF3", "storeid": "STG-67925", "availability": true } ], "offerSpecifications": { "price": 23.25 } } The validation logic for the same is written as Map<String, Object>…

VIEW QUESTION

convert String to json object with wrong string

I have String like "[{'techid':'0128','daPoints':3,'speedingPoints':3,'fleetInspectionPoints':3,'lofPoints':3,'missedTrgModules':null,'fullName':'MANPREET SINGH','safetyInspectPoints':3,'missedTrgPoints':3,'speeding_qty':null,'safetyTotalPoints':21,'atFaultPoints':3,'atFaultAccident':null,'region':'PYEM','supervisor':'AGHATOR OSA','driverAlert':null,'status':'A'}]" need to convert into Json format trying something like this const text = "[{'techid':'0128','daPoints':3,'speedingPoints':3,'fleetInspectionPoints':3,'lofPoints':3,'missedTrgModules':null,'fullName':'MANPREET SINGH','safetyInspectPoints':3,'missedTrgPoints':3,'speeding_qty':null,'safetyTotalPoints':21,'atFaultPoints':3,'atFaultAccident':null,'region':'PYEM','supervisor':'AGHATOR OSA','driverAlert':null,'status':'A'}]"; const myArr = JSON.parse(text); document.getElementById("demo").innerHTML = myArr[0]; But getting error :- Uncaught SyntaxError: Expected property name or…

VIEW QUESTION

Convert json data to DataTable or DataRow without loop

Hi every one it is possible to convert json to debatable without doing loop { "ipAddress": "10.203.10.162", "portNo": 45462, "protocol": "HTTP", "macAddress": "98:df:82:86:a4:27", "channelID": 1, "dateTime": "2023-01-11T14:57:24+04:00", "activePostCount": 1, "eventType": "AccessControllerEvent", "eventState": "active", "eventDescription": "Access Controller Event", "AccessControllerEvent": { "deviceName":…

VIEW QUESTION
Back To Top
Search