Quantcast
Channel: VBForums - jQuery
Viewing all articles
Browse latest Browse all 69

[RESOLVED] parseJSON Returning Wrong Type

$
0
0
I'm attempting to load the following literal into a JSON object, but when I call typeof on the variable it says that it is an object rather than an array. Can you spot what could be causing this:
Code:

var data = $.parseJSON('[{"Type":"Boat","Name":"Merle Gonsoulin","Official_Number":"1270118","Length":78,"Breadth":34,"Depth":10,"Gross_Tons":222,"HP":2000,"Engine":"Cummins KTA38M2","Built":2016,"Status":"Standby"},{"Type":"Barge","Name":"Gonsoulin 546","Official_Number":"1263066","Length":297.5,"Width":54,"Depth":12,"BBL":30000,"Built":2015,"Status":"Standby"},{"Type":"Barge","Name":"Gonsoulin 528","Official_Number":"1240327","Length":297.5,"Width":54,"Depth":12,"BBL":30000,"Built":2015,"Status":"Standby"}]');
Here is the JSON uncompacted:
Code:

[
  {
    "Type": "Boat",
    "Name": "Merle Gonsoulin",
    "Official Number": "1270118",
    "Length": 78,
    "Breadth": 34,
    "Depth": 10,
    "Gross Tons": 222,
    "HP": 2000,
    "Engine": "Cummins KTA38M2",
    "Built": 2016,
    "Status": "Standby"
  },
  {
    "Type": "Barge",
    "Name": "Gonsoulin 546",
    "Official Number": "1263066",
    "Length": 297.5,
    "Width": 54,
    "Depth": 12,
    "BBL": 30000,
    "Built": 2015,
    "Status": "Standby"
  },
  {
    "Type": "Barge",
    "Name": "Gonsoulin 528",
    "Official Number": "1240327",
    "Length": 297.5,
    "Width": 54,
    "Depth": 12,
    "BBL": 30000,
    "Built": 2015,
    "Status": "Standby"
  }
]


Viewing all articles
Browse latest Browse all 69

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>