I would like to parse a JSON using LitJSON. My JSON looks like :
{
"title_roof": "TILESen",
"detailsRed": "Classic red",
"detailsRedShaded": "Shaded red",
"detailsGreen": "Forest green",
"detailsGreenShaded": "Shaded green",
"detailsTerracota": "Terracotta",
"detailsBrownShaded": "Shaded brown",
"detailsBlack": "Black ",
"title_wall": "WALLS",
"wall1": {
"name": "wall_name",
"normal_texture": "normal.png",
"hover_texture": "hover.png",
"wall_texture": "texture.png"
},
"wall2": {
"name": "wall_name_2",
"normal_texture": "normal2.png",
"hover_texture": "hover2.png",
"wall_texture": "texture2.png"
},
"tile1": {
"name": "tile_name",
"normal_texture": "normal.png",
"hover_texture": "hover.png",
"details_texture": "details.png",
"roof_texture": "roof.png",
"ridge_color": "001144"
}
}
I tried using this idea but i am geeting error like:
Expression denotes a `type’, where a “variable”, “value” or “method group” was expected
when i use :
using UnityEngine;
using System.Collections;
using LitJson;
public class Loadr : MonoBehaviour {
string url= "http://domain/site/get_texts.php"; //this is where i get my json
void Start (){
WWW www = new WWW(url);
print(www.text);
var a = new LitJson.JsonReader(www.text);
print(a.ToString());
}
}
How can i parse the json to access all the walls or all the tiles (in reality there will be more than then one) and access “name” property for e.g. ??