json2struct | json to struct | JSON Processing library
kandi X-RAY | json2struct Summary
kandi X-RAY | json2struct Summary
json to struct
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of json2struct
json2struct Key Features
json2struct Examples and Code Snippets
Community Discussions
Trending Discussions on json2struct
QUESTION
I am trying to convert json into a golang nested struct. It is only partially working. Most fields do not parse correctly, although some do. Why doesn't all the data from json get converted into a golang struct? My guess is that I have some mistake between my json format and the golang struct, but I don't see it. Posting to get some other eyes on the problem.
When I run the program, the machine ip address is unmarshalled, but the test run id is not. Here is the output from my main method:
...ANSWER
Answered 2017-Oct-22 at 15:46In your JSON, you have a typo (an extra colon). You call the field in question "Id:"
instead of "Id"
. Remove the :
and the code should work!
Note that your NodeId
field will also likely not populate, because in the JSON, you call it "NodeId (cluster)"
instead of "NodeId"
. The field names must match exactly in JSON and Go. If you want to use different field names in JSON than in Go, annotate your struct with the JSON names:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install json2struct
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page