# Json data issue

**URL:** <https://forum.alpaca.markets/t/json-data-issue/9035>\
**Category:** Alpaca Market Data\
**Created:** [April 3, 2022, 3:47am UTC](https://forum.alpaca.markets/t/json-data-issue/9035 "2022-04-03T03:47:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Bishop](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/phillip_bishop/32/3866_2.png) [@Phillip\_Bishop](https://forum.alpaca.markets/u/Phillip_Bishop)\
**Post date:** [April 3, 2022, 3:47am UTC](https://forum.alpaca.markets/t/json-data-issue/9035/1 "2022-04-03T03:47:21Z")

</div>

I’m having issues trying to get specific data from quotes using json. I don’t know if it’s my formatting or what, but I’m unable to pull just the ask price by itself using websockets and json.

```auto
import config
import websocket, json

def on_open(ws):
    print("opened")
    auth_data = {
        "action": "auth", "key": config.API_KEYP, "secret": config.SECRET_KEYP
    }

    ws.send(json.dumps(auth_data))
    listen_message = {"action": "subscribe", "quotes": ['BTCUSD']}
    ws.send(json.dumps(listen_message))

def on_message(ws, message):
    print("received a message")
    print(message)
    formatted_message = json.loads(message)
    print(formatted_message['ap'])
    
def on_close(ws):
    print("closed connection")

socket = 'wss://stream.data.alpaca.markets/v1beta1/crypto'

ws = websocket.WebSocketApp(socket, on_open=on_open, on_message=on_message, on_close=on_close)
ws.run_forever()

```
