I am trying to decode following JSON file
{
"email": "mail@gmail.com",
"password": "12345",
"languageProficiency": {
"language": "English",
"proficiency": 4
},
"tags": [
{
"name": "singing"
},
{
"name": "dance"
}
]
}
When I do this
$data = json_decode($jsonContent, true);
echo $data;
die();
I have following error:
Array value found, but an object is required
Question
1) How can I view data from JSON 2) How can I access property of each object in tags array
I am validating Json content againsts this schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"languageProficiency": {
"type": "object",
"properties": {
"language": {
"type": "string"
},
"proficiency": {
"type": "integer"
}
},
"required": [
"language",
"proficiency"
]
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
}
},
"required": [
"email",
"password",
"languageProficiency",
"tags"
]
}
UPDATE
I tried following to view json content
print_r($data)
But I still get same error