mercredi 3 février 2021

How to extract json values from json in javascript

Hello guys I am currently trying to phrase a json but it's hard for me the json response is

{
"txs": 
{
    "lock_time": 0,
    "ver": 1,
    "size": 372,
    "inputs": [
        {
            "sequence": 4294967295,
            "prev_out": {
                "spent": true,
                "tx_index": 78636642,
                "type": 0,
                "addr": "1Dihat9Fy1ZDzFCq33LN5M7kzG3Fmi3FbZ",
                "value": 61140,
                "n": 1,
                "script": "76a9148b84711990f82d3cd70013e738787506a2156ebf88ac"
            },
            "script": "47304402203409c3381b75deac615630125c62af73e959e4e42431397209d0298da272c4b4022011720c0e8ecc8a4d01e1f6210891fe5e65f581473c05f0b15bc38010ca5155610121038b1c61898ba817c0361fb910c001cddf309388f6e156f96de749fdbb1c531f34"
        },
        {
            "sequence": 4294967295,
            "prev_out": {
                "spent": true,
                "tx_index": 78634898,
                "type": 0,
                "addr": "1Dihat9Fy1ZDzFCq33LN5M7kzG3Fmi3FbZ",
                "value": 379950,
                "n": 1,
                "script": "76a9148b84711990f82d3cd70013e738787506a2156ebf88ac"
            },
            "script": "473044022051029de181886a8225e78ea8c97fcdff4fdf65bd5479cf4370a8bf38ffd8770002202e788bb00aa4b017249eeefdfcf49cc2e591a7dbb25a1b2a3df924505b7683a50121038b1c61898ba817c0361fb910c001cddf309388f6e156f96de749fdbb1c531f34"
        }
    ,
    "doublespend": false,
    "time": 1424718521,
    "txindex": 78637260,
    "vinsz": 2,
    "hash": "011931da4d5ef3afde1b043f285b27cec2883b9d77feda71fe67b13341778494",
    "voutsz": 2,
    "relayedby": "127.0.0.1",
    "out": [
        {
            "addrtaglink": "http://luckyb.it/",
            "addrtag": "LuckyBit blue",
            "spent": false,
            "txindex": 78637260,
            "type": 0,
            "addr": "1LuckyB5VGzdZLZSBZvw8DR17iiFCpST7L",
            "value": 356450,
            "n": 0,
            "script": "76a914da5dde86d69a5d9dad88763f2df4b048953c7d0488ac"
        },
        {
            "spent": false,
            "txindex": 78637260,
            "type": 0,
            "addr": "1Dihat9Fy1ZDzFCq33LN5M7kzG3Fmi3FbZ",
            "value": 74640,
            "n": 1,
            "script": "76a9148b84711990f82d3cd70013e738787506a2156ebf88ac"
        }
    ]
}
]
}

this json is stored in a variable "Content".

I used Var data = content.txs.inputs.addr

To take out the info from that but it show nothing null. I also tried only content and it works but it doesnt working with content.txs.inputs.addr anyone help me out to solve this any java devloper I face this type of json first time.

Aucun commentaire:

Enregistrer un commentaire