/
  • تبدیل json به php

  • ارسال پاسخ   امتیاز موضوع:
    • 0 رأی - میانگین امیتازات: 0
    • 1
    • 2
    • 3
    • 4
    • 5

    حالت موضوعی | حالت خطی تبدیل json به php
    نویسنده پیام
    kbkiran آفلاین
    عضو جدید
    **

    ارسال‌ها: 1
    تاریخ عضویت: ۱۳۹۶ تير ۳
    اعتبار: 0
    تشکرها : 0
    ( 0 تشکر در 0 ارسال )
    ارسال: #1
    Exclamation تبدیل json به php
    سلام به همه
    من یک فایل چند لایه json دارم که از طریق php میخوام کامل ویرایش و دوباره ارسال کنم.
    کد:
    {
        "variables": [],
        "info": {
            "name": "Test API",
            "_postman_id": "4f1fda5f-910c-71ac-0914-db2d0b9c6521",
            "description": "",
            "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
        },
        "item": [
            {
                "name": "Access Token",
                "request": {
                    "url": "{{url}}/api/authorize/access_token",
                    "method": "POST",
                    "header": [],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "client_id",
                                "value": "{{clientId}}",
                                "type": "text"
                            },
                            {
                                "key": "client_secret",
                                "value": "{{clientSecret}}",
                                "type": "text"
                            },
                            {
                                "key": "grant_type",
                                "value": "client_credentials",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "Client Credentials for Postman"
                },
                "response": []
            },
            {
                "name": "Layout create",
                "request": {
                    "url": "{{url}}/api/layout?envelope=1",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "name",
                                "value": "Postman layout",
                                "type": "text"
                            }
                        ]
                    },
                    "description": ""
                },
                "response": []
            },
            {
                "name": "Region create",
                "request": {
                    "url": "{{url}}/api/region/24?envelope=1",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "width",
                                "value": "300",
                                "type": "text"
                            },
                            {
                                "key": "height",
                                "value": "450",
                                "type": "text"
                            },
                            {
                                "key": "top",
                                "value": "150",
                                "type": "text"
                            },
                            {
                                "key": "left",
                                "value": "350",
                                "type": "text"
                            }
                        ]
                    },
                    "description": ""
                },
                "response": []
            },
            {
                "name": "Library Upload",
                "request": {
                    "url": "{{url}}/api/library",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "files",
                                "value": "",
                                "type": "file"
                            },
                            {
                                "key": "name",
                                "value": "API UPLOAD",
                                "type": "text"
                            },
                            {
                                "key": "oldMediaId",
                                "value": "249",
                                "type": "text",
                                "disabled": true
                            },
                            {
                                "key": "updateInLayouts",
                                "value": "1",
                                "type": "text",
                                "disabled": true
                            },
                            {
                                "key": "deleteOldRevisions",
                                "value": "1",
                                "type": "text",
                                "disabled": true
                            }
                        ]
                    },
                    "description": ""
                },
                "response": []
            },
            {
                "name": "Playlist Library Assign",
                "request": {
                    "url": "{{url}}/api/playlist/library/assign/177",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "media[]",
                                "value": "134",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "\n"
                },
                "response": []
            },
            {
                "name": "Action: Change Layout",
                "request": {
                    "url": "{{url}}/api/displaygroup/2/action/changeLayout?envelope=1",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "layoutId",
                                "value": "24",
                                "type": "text"
                            },
                            {
                                "key": "downloadRequired",
                                "value": "true",
                                "type": "text"
                            },
                            {
                                "key": "changeMode",
                                "value": "queue",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "Root Request\n"
                },
                "response": []
            },
            {
                "name": "Action: Overlay Layout",
                "request": {
                    "url": "{{url}}/api/displaygroup/28/action/overlayLayout?envelope=1",
                    "method": "POST",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "layoutId",
                                "value": "73",
                                "type": "text"
                            },
                            {
                                "key": "downloadRequired",
                                "value": "true",
                                "type": "text"
                            },
                            {
                                "key": "duration",
                                "value": "10",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "Root Request\n"
                },
                "response": []
            },
            {
                "name": "Layouts",
                "request": {
                    "url": "{{url}}/api/layout?layout=&embed=regions,playlists",
                    "method": "GET",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "client_id",
                                "value": "{{clientId}}",
                                "type": "text"
                            },
                            {
                                "key": "client_secret",
                                "value": "{{clientSecret}}",
                                "type": "text"
                            },
                            {
                                "key": "grant_type",
                                "value": "client_credentials",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "\n"
                },
                "response": []
            },
            {
                "name": "DisplayGroups",
                "request": {
                    "url": "{{url}}/api/displaygroup",
                    "method": "GET",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "access_token",
                                "value": "{{access_token}}",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "\n"
                },
                "response": []
            },
            {
                "name": "Displays",
                "request": {
                    "url": "{{url}}/api/display",
                    "method": "GET",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {
                        "mode": "formdata",
                        "formdata": [
                            {
                                "key": "client_id",
                                "value": "lqDQiJiv8lEWi9TTddSgTGb8aIod0OLpLWP0ipnn",
                                "type": "text"
                            },
                            {
                                "key": "client_secret",
                                "value": "gKtQM7Jnt02LpnRyknuUyI7pI7xmlvW5M9bZ7LVtxC7gLzNp1IXUMfGvVNmdeoEFVkTVhKEmaIGKl9Rt​pnhqlVb71oq32443VuHYQgQdHvfr2iTgdN4x10Xig87QM47P2CQXQ5gn6Y6XpKuLq27flNDUtsHEyWiT​irQL3HcUipL8dEbBwJzLvqDmzFoq7Q83MWs8TDkcVIuolx5qWLdeN7YLwV6liAa2gR0egmc5yUQkCGMx​zx4bhGVMDywAfa",
                                "type": "text"
                            },
                            {
                                "key": "grant_type",
                                "value": "client_credentials",
                                "type": "text"
                            }
                        ]
                    },
                    "description": "\n"
                },
                "response": []
            },
            {
                "name": "Request Screenshot",
                "request": {
                    "url": "{{url}}/api/display/requestscreenshot/33?envelope=1",
                    "method": "PUT",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {},
                    "description": ""
                },
                "response": []
            },
            {
                "name": "Media",
                "request": {
                    "url": "{{url}}/api/library?media=API",
                    "method": "GET",
                    "header": [
                        {
                            "key": "Authorization",
                            "value": "Bearer {{access_token}}",
                            "description": ""
                        }
                    ],
                    "body": {},
                    "description": ""
                },
                "response": []
            }
        ]
    }
    لفطا از توابع json_decode encode نگین چون اصلا به درد من نمیخوره من کامل میخوام به صورت شی گرا کار کنم مشکال من این که تعداد لایه ها زیاده
    (آخرین ویرایش در این ارسال: ۱۳۹۶ تير ۳ ۰۳:۴۵ عصر، توسط kbkiran.)
    ۱۳۹۶ تير ۳ ۰۳:۴۲ عصر
    یافتن ارسال‌ها پاسخ با نقل قول
     تشکر شده توسط :
    Hamid آفلاین
    حمید رضا رحیمی
    ****

    ارسال‌ها: 562
    تاریخ عضویت: ۱۳۹۰ آبان ۹
    اعتبار: 20
    تشکرها : 553
    ( 360 تشکر در 227 ارسال )
    ارسال: #2
    RE: تبدیل json به php
    مشکلت با json_decode چیه که میگی اینو نگید ؟؟
    بعد این قضیه چه ربطی به شی گرایی داره که میگی میخوام کامل شی گرا انجام بدم !؟ خب ارایه کن تغییرت رو انجام بده دوباره ابجکت کن !
    __________________________________________________________________________
    ۱۳۹۶ تير ۴ ۰۷:۵۵ صبح
    یافتن ارسال‌ها WWW پاسخ با نقل قول
     تشکر شده توسط : Alaa مردی از پارس
    « قدیمی تر | تازه‌ تر »

    ارسال پاسخ
    پرش به انجمن:


    کاربرانِ درحال بازدید از این موضوع: 1 مهمان
    IranPHP.org | تماس با ما | بازگشت به بالا | بازگشت به محتوا | بایگانی | پیوند سایتی RSS