This code
List<String> ls = new List<String>{'32', '4text', 'text5'};
Object obj;
for (String s : ls){
try{
obj = JSON.deserializeUntyped(s);
System.debug(s + ' becomes ' + obj);
System.debug(obj instanceof Integer);
}
catch (JsonException e) {
System.debug(s + ' is not json' );
}
}
returns, or rather displays, to be exact
32 becomes 32
true
4text becomes 4
true
text5 is not json
I would expect 4text to be interpreted as String, not Integer. Maybe it's how JSON works but I didn't find it in RFC 8529 (I admit I just had a quick look)... Or is it a bug ?
Thanks