AutoTools JSON randomly sorting

Discussion in 'AutoApps' started by Daren, Nov 30, 2018.

  1. Daren

    Daren New Member

    Joined:
    Nov 30, 2018
    Messages:
    1
    Likes Received:
    0
    I have the following JSON data through a url. I am using auto tools to put the symbol and lastPriceInDouble into its own arrays. however, when i output the array, the symbols are not in the same order they are displayed on JSON data. I'm not sure how its sorting, but right now its showing as /ZNH19 /CL /GC /ES /ZBH19. This order changes sometimes as well. The JSON header data has this sorted as /ES /ZBH19 /ZNH19 /GC /CL. How do i get it to sort in the order as displayed by the JSON data?


    {"/ES":{"assetType":"FUTURE","symbol":"/ES","bidPriceInDouble":2749.75,"askPriceInDouble":2750.0,"lastPriceInDouble":2749.75,"bidSizeInLong":20,"askSizeInLong":115,"bidId":"?","askId":"?","totalVolume":840835,"lastSizeInLong":1,"quoteTimeInLong":1543605170312,"tradeTimeInLong":1543605169998,"highPriceInDouble":2752.0,"lowPriceInDouble":2729.0,"closePriceInDouble":2744.25,"exchange":"E","description":"E-mini S\u0026P 500 Index Futures,Dec-2018,ETH","lastId":"?","openPriceInDouble":2742.0,"changeInDouble":5.5,"futurePercentChange":0.0020041905803042724,"exchangeName":"XCME","securityStatus":"Unknown","openInterest":2749286,"mark":2749.75,"tick":0.25,"tickAmount":12.5,"product":"/ES","futurePriceFormat":"D,D","futureTradingHours":"GLBX(de\u003d1640;0\u003d-1700151515301615;1\u003dr-17001515r15301615d-15551640;7\u003dd-16401555)","futureIsTradable":true,"futureMultiplier":50.0,"futureIsActive":true,"futureSettlementPrice":2744.25,"futureActiveSymbol":"/ESZ18","futureExpirationDate":1545368400000,"delayed":false},"/ZBH19":{"assetType":"FUTURE","symbol":"/ZBH19","bidPriceInDouble":139.90625,"askPriceInDouble":139.9375,"lastPriceInDouble":139.90625,"bidSizeInLong":446,"askSizeInLong":757,"bidId":"?","askId":"?","totalVolume":217119,"lastSizeInLong":2,"quoteTimeInLong":1543605170145,"tradeTimeInLong":1543605165209,"highPriceInDouble":140.03125,"lowPriceInDouble":139.53125,"closePriceInDouble":139.5,"exchange":"E","description":"30-Year U.S. Treasury Bond Futures,Mar-2019,ETH","lastId":"?","openPriceInDouble":139.59375,"changeInDouble":0.40625,"futurePercentChange":0.0029121863799283156,"exchangeName":"XCBT","securityStatus":"Unknown","openInterest":936089,"mark":139.90625,"tick":0.03125,"tickAmount":31.25,"product":"/ZB","futurePriceFormat":"3,32","futureTradingHours":"GLBX(de\u003d1640;0\u003d-17001600;1\u003d-17001600d-15551640;7\u003dd-16401555)","futureIsTradable":true,"futureMultiplier":1000.0,"futureIsActive":false,"futureSettlementPrice":139.5,"futureActiveSymbol":"","futureExpirationDate":1553054400000,"delayed":false},"/ZNH19":{"assetType":"FUTURE","symbol":"/ZNH19","bidPriceInDouble":119.421875,"askPriceInDouble":119.4375,"lastPriceInDouble":119.42187500000001,"bidSizeInLong":3074,"askSizeInLong":5436,"bidId":"?","askId":"?","totalVolume":978768,"lastSizeInLong":1,"quoteTimeInLong":1543605170145,"tradeTimeInLong":1543605165017,"highPriceInDouble":119.53125000000001,"lowPriceInDouble":119.35937500000001,"closePriceInDouble":119.31250000000001,"exchange":"E","description":"10-Year U.S. Treasury Note Futures,Mar-2019,ETH","lastId":"?","openPriceInDouble":119.37500000000001,"changeInDouble":0.109375,"futurePercentChange":9.167103195390256E-4,"exchangeName":"XCBT","securityStatus":"Unknown","openInterest":4037676,"mark":119.42187500000001,"tick":0.015625,"tickAmount":15.625,"product":"/ZN","futurePriceFormat":"3,32","futureTradingHours":"GLBX(de\u003d1640;0\u003d-17001600;1\u003d-17001600d-15551640;7\u003dd-16401555)","futureIsTradable":true,"futureMultiplier":1000.0,"futureIsActive":false,"futureSettlementPrice":119.31250000000001,"futureActiveSymbol":"","futureExpirationDate":1553054400000,"delayed":false},"/GC":{"assetType":"FUTURE","symbol":"/GC","bidPriceInDouble":1220.1,"askPriceInDouble":1220.3,"lastPriceInDouble":1220.4,"bidSizeInLong":23,"askSizeInLong":9,"bidId":"?","askId":"?","totalVolume":1974,"lastSizeInLong":2,"quoteTimeInLong":1543605170349,"tradeTimeInLong":1543604646783,"highPriceInDouble":1225.0,"lowPriceInDouble":1216.1000000000001,"closePriceInDouble":1224.1000000000001,"exchange":"E","description":"Gold Futures,Dec-2018, ETH","lastId":"?","openPriceInDouble":1224.1000000000001,"changeInDouble":-3.7000000000000455,"futurePercentChange":-0.0030226288701903806,"exchangeName":"XCEC","securityStatus":"Unknown","openInterest":8864,"mark":1220.3,"tick":0.1,"tickAmount":10.0,"product":"/GC","futurePriceFormat":"D,D","futureTradingHours":"GLBX(de\u003d1640;0\u003d-17001615;1\u003d-17001615d-15551640;7\u003dd-16401555)","futureIsTradable":true,"futureMultiplier":100.0,"futureIsActive":true,"futureSettlementPrice":1224.1000000000001,"futureActiveSymbol":"/GCZ18","futureExpirationDate":1545886800000,"delayed":false},"/CL":{"assetType":"FUTURE","symbol":"/CL","bidPriceInDouble":51.22,"askPriceInDouble":51.23,"lastPriceInDouble":51.230000000000004,"bidSizeInLong":14,"askSizeInLong":12,"bidId":"?","askId":"?","totalVolume":691023,"lastSizeInLong":1,"quoteTimeInLong":1543605170115,"tradeTimeInLong":1543605169912,"highPriceInDouble":51.79,"lowPriceInDouble":49.65,"closePriceInDouble":51.45,"exchange":"E","description":"Light Sweet Crude Oil Futures,Jan-2019,ETH","lastId":"?","openPriceInDouble":51.27,"changeInDouble":-0.21999999999999886,"futurePercentChange":-0.004275996112730785,"exchangeName":"XNYM","securityStatus":"Unknown","openInterest":421193,"mark":51.23,"tick":0.01,"tickAmount":10.0,"product":"/CL","futurePriceFormat":"D,D","futureTradingHours":"GLBX(de\u003d1640;0\u003d-17001615;1\u003d-17001615d-15551640;7\u003dd-16401555)","futureIsTradable":true,"futureMultiplier":1000.0,"futureIsActive":true,"futureSettlementPrice":51.45,"futureActiveSymbol":"/CLF19","futureExpirationDate":1545195600000,"delayed":false}}
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,477
    Likes Received:
    806
    Hi. The JSON you've posted does not have arrays. It has properties. Properties do not have any inherent order to them :) Only arrays do.
     
: json, autotools

Share This Page