My json file from server is like this:
{"status":"success","data":{"projectId":"572ca0cde163d","sensorId":"572ca2deea163b","createTime":1462514044,"updateTimeStamp":1462514044,"recognPicUrl":"http://192.168.1.115:8500/dddd.jpg","drawingModule":{"subjectTemplateId":"16","drawingUnits":[{"drawingUnitId":"572ca0c4f14c023cdeea163c",
"drawingResources":
[{"resourceUrl":"http://192.168.1.115:8300/dds.png","serviceProps":{},"resourceType":"IMG"}],"drawingComponentId":"1"}],
"templateConfig":{"isVertical":false}},"targetId":"ba0a0d83c657e49eb312"}}
How can I read the value "isVertical"?
First of all, your
Json
is not valid. There should be a ':
' between"serviceProps"
and{},
.Here is a fixed verision of your Json data.
To answer your question, you can easily extract
isVertical
by creating a class that represents all the keys then pull theisVertical
from that class.Unity add
Json
native support in 5.3 release. The solution below requires that you have 5.3 and above and it should work. Tested with 5.4.0b13 and it works Should work on 5.3.Code to Read the
isVertical
Json value: