将json_decode格式转换为json_encode格式

时间:2014-08-26 11:41:45

标签: java php json

我从我的网络服务器获取此JSON响应。因为我搜索了这种格式是json解码格式。我将如何将其转换为json编码格式。

stdClass Object
(

[id] => 4ffc88e7-1413-fa9c-423c-53fc701b1044

[entry_list] => stdClass Object

    (
        [first_name] => stdClass Object
            (
                [name] => first_name
                [value] => dharmendra
            )

        [last_name] => stdClass Object
            (
                [name] => last_name
                [value] => singh
            )

        [primary_address_city] => stdClass Object
            (
                [name] => primary_address_city
                [value] => gwalior
            )

        [primary_address_street] => stdClass Object
            (
                [name] => primary_address_street
                [value] => chinchwad
            )

        [primary_address_state] => stdClass Object
            (
                [name] => primary_address_state
                [value] => mp
            )

        [phone_mobile] => stdClass Object
            (
                [name] => phone_mobile
                [value] => 55555555
            )

        [primary_address_country] => stdClass Object
            (
                [name] => primary_address_country
                [value] => in
            )

        [primary_address_postalcode] => stdClass Object
            (
                [name] => primary_address_postalcode
                [value] => 4444444
            )

    )

) 

1 个答案:

答案 0 :(得分:0)

这是来自SugarCRM REST api的json响应

解决方案是写 print(json_encode(set_result))代替

打印(set_result)