-2

I`m trying to get a specific line, and it's elements from this JSON API.

The link to the API is this: https://btc-e.com/api/3/info/

And this is what it will return:

{
    "server_time": 1424431698,
    "pairs": {
        "btc_usd": {
            "decimal_places": 3,
            "min_price": 0.1,
            "max_price": 3200,
            "min_amount": 0.01,
            "hidden": 0,
            "fee": 0.2
        },
        "btc_rur": {
            "decimal_places": 5,
            "min_price": 1,
            "max_price": 96000,
            "min_amount": 0.01,
            "hidden": 0,
            "fee": 0.2
        },
        "btc_eur": {
            "decimal_places": 5,
            "min_price": 0.1,
            "max_price": 3200,
            "min_amount": 0.01,
            "hidden": 0,
            "fee": 0.2
        },
        "btc_cnh": {
            "decimal_places": 2,
            "min_price": 1,
            "max_price": 15000,
            "min_amount": 0.01,
            "hidden": 0,
            "fee": 0.2
        },
        "btc_gbp": {
            "decimal_places": 5,
            "min_price": 0.1,
            "max_price": 1600,
            "min_amount": 0.01,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_btc": {
            "decimal_places": 5,
            "min_price": 0.0001,
            "max_price": 10,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_usd": {
            "decimal_places": 6,
            "min_price": 0.0001,
            "max_price": 200,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_rur": {
            "decimal_places": 5,
            "min_price": 0.1,
            "max_price": 6000,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_eur": {
            "decimal_places": 3,
            "min_price": 0.0001,
            "max_price": 200,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_cnh": {
            "decimal_places": 2,
            "min_price": 0.1,
            "max_price": 1000,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ltc_gbp": {
            "decimal_places": 3,
            "min_price": 0.001,
            "max_price": 100,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "nmc_btc": {
            "decimal_places": 5,
            "min_price": 0.0001,
            "max_price": 10,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "nmc_usd": {
            "decimal_places": 3,
            "min_price": 0.001,
            "max_price": 100,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "nvc_btc": {
            "decimal_places": 5,
            "min_price": 0.0001,
            "max_price": 10,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "nvc_usd": {
            "decimal_places": 3,
            "min_price": 0.001,
            "max_price": 100,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "usd_rur": {
            "decimal_places": 5,
            "min_price": 25,
            "max_price": 150,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "eur_usd": {
            "decimal_places": 5,
            "min_price": 0.5,
            "max_price": 2,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "eur_rur": {
            "decimal_places": 5,
            "min_price": 30,
            "max_price": 200,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "usd_cnh": {
            "decimal_places": 4,
            "min_price": 1,
            "max_price": 15,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "gbp_usd": {
            "decimal_places": 4,
            "min_price": 0.1,
            "max_price": 3,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ppc_btc": {
            "decimal_places": 5,
            "min_price": 0.0001,
            "max_price": 10,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        },
        "ppc_usd": {
            "decimal_places": 3,
            "min_price": 0.001,
            "max_price": 100,
            "min_amount": 0.1,
            "hidden": 0,
            "fee": 0.2
        }
    }
}

What i want is to parse only the line with "ltc_btc" at the end, and specifically i would like to get all elements into a variable, so "decimal_places" , "min_price", etc, all of it inbetween the {} brackets, but only for the "ltc_btc" line.

So only this please:

{"decimal_places":5,"min_price":0.1,"max_price":1600,"min_amount":0.01,"hidden":0,"fee":0.2},"ltc_btc":

How to get the variables from that line? I`m using JSON.Net aswell.

emerson.marini
  • 9,331
  • 2
  • 29
  • 46
Bitcoin Blogger
  • 61
  • 1
  • 1
  • 4

1 Answers1

0

You can't do that. You have to deserialize all the JSON and then retrieve that line from the deserialized object.

Naumand
  • 71
  • 3