So I have fetch and it returns this:
{ Global Quote: { 01. symbol: "TSLA", 02. open: 595.0000, 03. high: 607.570, 04. low: 502.0000, 05. price: 546.6200, 06. volume: 22460363, 07. latest trading day: 2020-03-13, 08. previous close: 560.5500, 09. change: -13.9300, 10. change percent: -2.4851% } }
How do I work with it, when it has multiple words in property name ?
The data you show isn't valid JSON and won't be readily parsable without modifying. JSON keys and values should be in quotation marks. The properties can be accessed either with a . or in a []. For multiple word keys, use brackets. Example:
a = {
"valid property multiple words": "valid value 1",
"validpropertyoneword": "valid value 2"
};
a['valid property multiple words']; //<- evaluates to "valid value 1"
a.validpropertyoneword //<- evaluates to "valid value 2"
b = {
invalid property: invalid value
}; //<- invalid JSON
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.