Try to search your question here, if you can't find : Ask Any Question Now ?

I have 2 json how can I decode them with 1 struct?

HomeCategory: stackoverflowI have 2 json how can I decode them with 1 struct?
pragati asked 3 weeks ago

My jsons are similar and their only difference is joineduser

in second joiend user is []

…………………………………………….
…………………………………………….
…………………………………………….
MYFIRST JSON

…………………………………………….
…………………………………………….
…………………………………………….

{
"joined_user": [
    {
        "_id": "5c72c03cd1c32313908845d8"
    },
    {
        "_id": "5c72c14ad1c32313908845db"
    }
],
"allRooms": [
    {
        "Capacity": {
            "Free": 10,
            "Total": 10
        },
        "Finished": false,
        "Pic": "http://192.168.1.101:2525/icon.png",
        "_id": "5c72bf3fd1c32313908845d6",
        "Coin_input": 10,
        "Award_money": 100000,
        "Award_coin": 100,
        "Match_time": "1551551483",
        "Winner_number": 1
    },
    {
        "Capacity": {
            "Free": 20,
            "Total": 20
        },
        "Finished": false,
        "Pic": "http://192.168.1.101:2525/icon.png",
        "_id": "5c72bf58d1c32313908845d7",
        "Coin_input": 20,
        "Award_money": 200000,
        "Award_coin": 200,
        "Match_time": "1551551483",
        "Winner_number": 1
    },
    {
        "Capacity": {
            "Free": 9,
            "Total": 10
        },
        "Finished": false,
        "Pic": "http://192.168.1.101:2525/icon.png",
        "_id": "5c72c03cd1c32313908845d8",
        "Coin_input": 100,
        "Award_money": 100000,
        "Award_coin": 1000,
        "Match_time": "1551551483",
        "Winner_number": 1
    },
    {
        "Capacity": {
            "Free": 20,
            "Total": 20
        },
        "Finished": false,
        "Pic": "http://192.168.1.101:2525/icon.png",
        "_id": "5c72c066d1c32313908845d9",
        "Coin_input": 101,
        "Award_money": 200000,
        "Award_coin": 2000,
        "Match_time": "1551551483",
        "Winner_number": 1
    },
    {
        "Capacity": {
            "Free": 9209269,
            "Total": 10000000
        },
        "Finished": true,
        "Pic": "http://192.168.1.101:2525/icon.png",
        "_id": "5c72c14ad1c32313908845db",
        "Coin_input": 12,
        "Award_money": 50000,
        "Award_coin": 500,
        "Match_time": "1551540600",
        "Winner_number": 1
    }
]

}

…………………………………………….
…………………………………………….
…………………………………………….
AND
MY SECOND JSON
…………………………………………….
…………………………………………….
…………………………………………….

{
"joined_user": "[]",
"allRooms": [
    {
        "Capacity": {
            "Free": 44,
            "Total": 100
        },
        "Finished": false,
        "Pic": "www",
        "_id": "5c73c1666f39db1de8977fd9",
        "Coin_input": 10,
        "Award_money": 10000,
        "Award_coin": 1000,
        "Match_time": "9",
        "Winner_number": 2
    },
    {
        "Capacity": {
            "Free": 9999,
            "Total": 9999
        },
        "Finished": false,
        "Pic": "129",
        "_id": "5c7535a56f39db1de897802d",
        "Coin_input": 9,
        "Award_money": 99999,
        "Award_coin": 999,
        "Match_time": "9",
        "Winner_number": 9
    },
    {
        "Capacity": {
            "Free": 9999,
            "Total": 9999
        },
        "Finished": false,
        "Pic": "129",
        "_id": "5c7535a66f39db1de897802e",
        "Coin_input": 9,
        "Award_money": 99999,
        "Award_coin": 999,
        "Match_time": "9",
        "Winner_number": 9
    },
    {
        "Capacity": {
            "Free": 9999,
            "Total": 9999
        },
        "Finished": false,
        "Pic": "129",
        "_id": "5c7535a86f39db1de897802f",
        "Coin_input": 9,
        "Award_money": 99999,
        "Award_coin": 999,
        "Match_time": "9",
        "Winner_number": 9
    }
]

}

1 Answers
Best Answer
Arben answered 3 weeks ago
Your Answer

11 + 2 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com