Reputation: 1003
I applied for a job and got a little test to do. Its pretty simple but I have to deal with a JSON object they supplied which is NOT formatted correctly.
I wonder if this is ok (I am pretty new to JSON) or not? (OK meaning I can still use it as a standard JSON object).
Here is the JSON string:
{"title": "Carbon Market Trader EU",
"link": "cmteu",
"children": [
{"title": "Analysis",
"link": "analysis",
"children": [
{"title": "Daily Reports",
"link": "daily",
"children": [
{"title": "Forward",
"link": "fwd",
"children": [
{"title": "Morning Report", "link": "morning"},
{"title": "Benchmark", "link": "bench"}
]}
]},
{"title": "Weekly Reports",
"link": "weekly",
"children": [
{"title": "Forward",
"link": "fwd",
"children": [
{"title": "Weekly Report","link": "weekly"}
]}
]},
{"title": "Monthly Reports","link": "mth"},
{"title": "Price Forecasts",
"link": "pfc",
"children": [
{"title": "Price Forecasts","link": "pfc"},
{"title": "Supply and Demand","link": "sad"}
]},
{"title": "Policy Updates","link": "pup"},
{"title": "Analyst Updates","link": "aup"},
{"title": "Carbon Market Brief","link": "cmb"},
{"title": "Report Library","link": "ml"},
{"title": "Reuters Insider","link": "ri"},
{"title": "Market Indicators",
"link": "mi",
"children": [
{"title": "Overview","link": "overview"},
{"title": "Breakdown",
"link": "breakdown"
"children": [
{"title": "Cross Commodity Indicators","link": "cci"},
{"title": "Technical Indicators","link": "ti"},
{"title": "Fundamental Indicators","link": "fi"},
{"title": "Information Indicators","link": "ii"}
]}
]}
]},
{"title": "Supply",
"link": "supply",
"children": [
{"title": "Cap","link": "cap"},
{"title": "Overview","link": "overview"},
{"title": "Reserves","link": "reserves"}
]},
{"title": "Demand",
"link": "demand",
"children": [
{"title": "Emissions Forecast","link": "ef"},
{"title": "Power and Heat Emissions","link": "phe"},
{"title": "Industry Emissions","link": "ie"}
]},
{"title": "Market Data",
"link": "md",
"children": [
{"title": "Carbon",
"link": "carbon",
"children": [
{"title": "Forward",
"link": "fwd",
"children": [
{"title": "EUA","link": "eua"},
{"title": "sCER","link": "cer"},
{"title": "RGA","link": "rga"}
]}
]},
{"title": "Coal",
"link": "coal",
"children": [
{"title": "Forward",
"link": "fwd",
"children": [
{"title": "API-2","link": "api"}
]}
]},
{"title": "Crude oil",
"link": "crude",
"children": [
{"title": "Forward",
"link": "fwd",
"children": [
{"title": "Brent","link": "brent"}
]}
]}
]}
]}
Upvotes: 0
Views: 467
Reputation: 2317
try passing that object to "eval()" - it fails. Invalid JSON. (I've got to admit to having a hard time seeing exactly why, though)
Upvotes: 1