- Home /
Using Json to store data for objects
Hi guys i realize there is a bit about this out there already but i cant seem to figure it out.
Im setting up a json file to hold a list of racing drivers like so
`{
"driverFname": "Christian",
{
"driverFname": "Christian",
"driverLname": "Grettel",
"driverCountry": "Germany",
"Age": 24,
"driverTeamInfo": {
"driverTeamID": 1,
"driverCarNum": 1
},
"driverStats": {
"driverSpeed": 94,
"driverConsistancy": 85,
"driverOvertaking": 65,
"driverDefence": 75,
"driverFeedback": 70
}
}'
Im still very new to C#, what im trying to do is read these values out and create an object with all these settings, i have about 24 drivers and i want to create an object for each of them. Im just a bit lost as to how to go about actualy sticking these values into an object and if my json formating and brackets are all right. Any help would be greatly appreciated
Answer by SolidSnake · Sep 17, 2012 at 03:06 PM
you can use this site to validate your JSON :
and use a parser to read it.. i would suggest MiniJSON:
http://forum.unity3d.com/threads/35484-MiniJSON-script-for-parsing-JSON-data
How can you use jsonlint within unity for validation?
Your answer
Follow this Question
Related Questions
How to get an object inside a json JsonUtility 0 Answers
Multiple Cars not working 1 Answer
Getting data out of Dictionary 0 Answers
Distribute terrain in zones 3 Answers
Manipulating Instanced Object 2 Answers