Skip to content

Instantly share code, notes, and snippets.

@modster
Created February 15, 2022 07:44
Show Gist options
  • Save modster/7b265fc858565057ac024aa7a22edfcf to your computer and use it in GitHub Desktop.
Save modster/7b265fc858565057ac024aa7a22edfcf to your computer and use it in GitHub Desktop.
Raw, Parsed, Destructured, Type Cast Data

Working with JSON

Raw JSON:

{"e":"kline","E":1644909835145,"s":"BTCUSDT","k":{"t":1644909780000,"T":1644909839999,"s":"BTCUSDT","i":"1m","f":1257785664,"L":1257786008,"o":"43581.65000000","c":"43569.89000000","h":"43587.00000000","l":"43568.60000000","v":"8.34228000","n":345,"x":false,"q":"363518.48082610","V":"3.57802000","Q":"155911.17141810","B":"0"}}

Parsed JSON:

{
  e: 'kline',
  E: 1644909929615,
  s: 'BTCUSDT',
  k: {
    t: 1644909900000,
    T: 1644909959999,
    s: 'BTCUSDT',
    i: '1m',
    f: 1257786448,
    L: 1257786610,
    o: '43576.10000000',
    c: '43579.16000000',
    h: '43582.69000000',
    l: '43576.10000000',
    v: '3.68630000',
    n: 163,
    x: false,
    q: '160647.20707930',
    V: '2.19916000',
    Q: '95837.27715800',
    B: '0'
  }
}

Destructured JSON:

{ t: 1644910380000, v: '43585.52000000' }

Type Cast:

{ time: 1644910500, price: 43582.52 }

More to come

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment