Python has a great library called json to help you take a json string and create a python dict from it.
From your example I have created the following code:
import json
## Given example string
json_string = '{"symbol": "BTCUSDT", "price": "37256.90000000"}'
## Create a python dict from json string using json library json.loads
json_dict = json.loads(json_string)
## What the new python dict looks like:
## json_dict = {'symbol': 'BTCUSDT', 'price': '37256.90000000'}
## Print your expected output
print(f'$BTC @ {json_dict["price"]}')
Print Output:
$BTC @ 37256.90000000
Using the python "json" library will automatically convert the json string to a python dict which you can then use any way you like (i.e. automatically removing all the extra "braces and ... other garbage that isn't needed.").
Let me know if this helped and if you have any questions!
Edit:
Per more back and forth in comments I took a look at the Binance API. The API endpoint your using is:
GET /api/v3/ticker/price
To get information from this you would need to make an HTTP request to:
https://api.binance.com/api/v3/ticker/price
Here is example working code:
import requests
import json
## Send a GET request to binance api
## Since this is a get request no apikey / secret is needed
response = requests.get("https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT")
## Print the text from the get request
## Output: {"symbol":"BTCUSDT","price":"37211.17000000"}
print(response.text)
## Response.text is a string so we can use json.loads on it
ticket = json.loads(response.text)
## Now that ticket is a python dict of the json string
## response from binance we can print what you want
print(f'$BTC @ {ticket["price"]}')
## Output: $BTC @ 37221.87000000
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…