• Victor Domtaz
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi, 
I'm using JSON.deserializeUntyped method, I tested it through dev console in 2 unrelated orgs and both of them gave the same strange result.
I run this code through anonymous window, which basically takes a JSON and through deserializeUntyped method, breaks it to pieces: 

string ex='{"Quote Line_Repeating":[{"Quote Line":{"Line ID":"1","Discount":"true","Discount Type":"Regular","Sell Multiplier":1,"Rep Net Multiplier":0.75,"Pricing":"true","Base List Price":866,"Base Currency":"USD","Quote List Price":866,"Quote Currency":"USD","Exchange Rate":1}}]}';

Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(ex);

List<Object> a = (List<Object>)m.get('Quote Line_Repeating');System.debug('ex: '+ex);System.debug('m: '+m);
 


 The result that I got for ex variable:

USER_DEBUG [6]|DEBUG|ex: {"Quote Line_Repeating":[{"Quote Line":{"Line ID":"1","Discount":"true","Discount Type":"Regular","Sell Multiplier":1,"Rep Net Multiplier":0.75,"Pricing":"true","Base List Price":866,"Base Currency":"USD","Quote List Price":866,"Quote Currency":"USD","Exchange Rate":1}}]}
 

The results which I got for m variable:

USER_DEBUG [7]|DEBUG|USER_DEBUG [7]|DEBUG|m: {Quote Line_Repeating=({Quote Line={Base Currency=USD, Base List Price=866, Discount=true, Discount Type=Regular, Exchange Rate=1, Line ID=1, Pricing=true, Quote Currency=USD, Quote List Price=866, Rep Net Multiplier=0.75, ...}})}
 

If you compare carefully the 2 logs, you'll see that after going through JSON.deserializeUntyped method, the "Sell Multiplier":1 value just vanished from the view and the log shows
It's seems that the 'deserializeUntyped' sorted the attributes and omitted all attributes after the 10th attribute. 

In addition, I tweaked the JSON by adding and removing attributes and always the result was the same, the first 10 alphabetical attributes appeared and the other were omitted.
I think that it's a bug, as I didn't find any documentation about this kind of SF limit, but maybe I'm missing something.
I'll be happy for assistance Thanks
Victor

Hi, 
I'm using JSON.deserializeUntyped method, I tested it through dev console in 2 unrelated orgs and both of them gave the same strange result.
I run this code through anonymous window, which basically takes a JSON and through deserializeUntyped method, breaks it to pieces: 

string ex='{"Quote Line_Repeating":[{"Quote Line":{"Line ID":"1","Discount":"true","Discount Type":"Regular","Sell Multiplier":1,"Rep Net Multiplier":0.75,"Pricing":"true","Base List Price":866,"Base Currency":"USD","Quote List Price":866,"Quote Currency":"USD","Exchange Rate":1}}]}';

Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(ex);

List<Object> a = (List<Object>)m.get('Quote Line_Repeating');System.debug('ex: '+ex);System.debug('m: '+m);
 


 The result that I got for ex variable:

USER_DEBUG [6]|DEBUG|ex: {"Quote Line_Repeating":[{"Quote Line":{"Line ID":"1","Discount":"true","Discount Type":"Regular","Sell Multiplier":1,"Rep Net Multiplier":0.75,"Pricing":"true","Base List Price":866,"Base Currency":"USD","Quote List Price":866,"Quote Currency":"USD","Exchange Rate":1}}]}
 

The results which I got for m variable:

USER_DEBUG [7]|DEBUG|USER_DEBUG [7]|DEBUG|m: {Quote Line_Repeating=({Quote Line={Base Currency=USD, Base List Price=866, Discount=true, Discount Type=Regular, Exchange Rate=1, Line ID=1, Pricing=true, Quote Currency=USD, Quote List Price=866, Rep Net Multiplier=0.75, ...}})}
 

If you compare carefully the 2 logs, you'll see that after going through JSON.deserializeUntyped method, the "Sell Multiplier":1 value just vanished from the view and the log shows
It's seems that the 'deserializeUntyped' sorted the attributes and omitted all attributes after the 10th attribute. 

In addition, I tweaked the JSON by adding and removing attributes and always the result was the same, the first 10 alphabetical attributes appeared and the other were omitted.
I think that it's a bug, as I didn't find any documentation about this kind of SF limit, but maybe I'm missing something.
I'll be happy for assistance Thanks
Victor