function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Base LineBase Line 

how do you deserializeuntyped such JSON data?

{ "Global Quote": { "01. symbol": "AAPL", "02. open": "191.5450", "03. high": "193.5863", "04. low": "190.3045", "05. price": "192.7400", "06. volume": "18761474", "07. latest trading day": "2019-06-14", "08. previous close": "194.1500", "09. change": "-1.4100", "10. change percent": "-0.7262%" } }

Please help me out? Thanks.
Alain CabonAlain Cabon
@Base Line
 
String jsonInput = '{ "Global Quote": { "01. symbol": "AAPL", "02. open": "191.5450", "03. high": "193.5863", "04. low": "190.3045", "05. price": "192.7400", "06. volume": "18761474", "07. latest trading day": "2019-06-14", "08. previous close": "194.1500", "09. change": "-1.4100", "10. change percent": "-0.7262%" } }';

Map<String, Object> g =  (Map<String, Object>)  JSON.deserializeUntyped(jsonInput);
Map<String, Object> q = (Map<String, Object>) g.get('Global Quote');

system.debug(q.keySet());

for (String k : q.keySet()) {
     system.debug(k + '=' + q.get(k));
}
Ajay K DubediAjay K Dubedi
Hi Base,

Try below code it may helpful for you:
String JSONString = { "Global Quote": { "01. symbol": "AAPL", "02. open": "191.5450", "03. high": "193.5863", "04. low": "190.3045", "05. price": "192.7400", "06. volume": "18761474", "07. latest trading day": "2019-06-14", "08. previous close": "194.1500", "09. change": "-1.4100", "10. change percent": "-0.7262%" } }

Object proposalFromPage =(Object)JSON.deserialize(profileVideoObj, Object.class);

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi