私は Symfony2/JSMSerializerBundle を使用しています。
フラットな json オブジェクトを PHP オブジェクトにシリアライズするとうまくいきます。しかし、私が使用する API は、多次元の Json 応答を提供します。
{
"Webmessage": {
"@version": "1.0",
"Header": {
"Country": "NL",
"Language": "NL"
},
"Content": {
"Filters": {
"Sizes": {
"Size": [
{
"@id": "241",
"#text": "3,5"
},
{
"@id": "55",
"#text": "36"
}
]
},
"Colours": {
"Colour": [
{
"@id": "159",
"#text": "wit"
},
{
"@id": "54",
"#text": "zwart"
}
]
}
}
}
}
}
逆シリアル化された PHP として、次のようなものが必要です。
Array
(
[sizes] => Array
(
[0] => AppBundle\Entity\Filter Object
(
[id:AppBundle\Entity\Filter:private] => 1
[text:AppBundle\Entity\Filter:private] => Heren
)
[1] => AppBundle\Entity\Filter Object
(
[id:AppBundle\Entity\Filter:private] => 2
[text:AppBundle\Entity\Filter:private] => Dames
)
)
[colour] => Array
(
[0] => AppBundle\Entity\Filter Object
(
[id:AppBundle\Entity\Filter:private] =>56
[text:AppBundle\Entity\Filter:private] => Black
)
[1] => AppBundle\Entity\Filter Object
(
[id:AppBundle\Entity\Filter:private] => 212
[text:AppBundle\Entity\Filter:private] => Yellow
)
)
)
これを行う方法のヒントは誰にありますか?
ありがとう!