2

I have JSON response data which has some scientific notation e.g. -1.E-2 , when we trying to de serialize with JSON2APEX, it is giving the Error as invalid input

FATAL_ERROR System.JSONException: Unexpected character ('E' (code 69)) in numeric value: Decimal point not followed by a digit a

I am not sure how to resolve this, is this salesforce Bug?

SoapUI is handling the conversion properly

  • Can you please post your JSON? – Saroj Bera Mar 8 '17 at 9:17
3

If I had to place the blame, I would say that the problem is with the application that is producing that JSON data. At least according to MDN, there isn't a JSON number pattern that has a decimal point immediately followed by an exponent part. There should always be digits after the decimal point if it is part of the number.

JSON = null
    or true or false
    or JSONNumber
    or JSONString
    or JSONObject
    or JSONArray

JSONNumber = - PositiveNumber
          or PositiveNumber
PositiveNumber = DecimalNumber
              or DecimalNumber . Digits
              or DecimalNumber . Digits ExponentPart
              or DecimalNumber ExponentPart
DecimalNumber = 0
             or OneToNine Digits
ExponentPart = e Exponent
            or E Exponent
Exponent = Digits
        or + Digits
        or - Digits
Digits = Digit
      or Digits Digit
Digit = 0 through 9
OneToNine = 1 through 9
  • Yes i agree. I requested the other application team, but unfortunately other application team asking SFDC should handle from their side how SOAP UI handling. – Raj_SFDC Mar 9 '17 at 7:22
  • That puts you in a tough spot then. I seriously doubt Salesforce would change this. I think that all you can really do here is show the people that are responsible for the other application that their implementation doesn't conform to the standards. Otherwise if they have other software that can parse their data as JSON, you might need to use that to interpret the data and then reserialize into a standard format that salesforce accepts. – martin Mar 9 '17 at 7:42
  • No problem. Best of luck. – martin Mar 9 '17 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.