0

I am using https://workbench.developerforce.com/restExplorer.php . Trying to add new patient, on URL /services/data/v46.0/sobjects/HealthCloudGA__EhrPatient__c, with POST method, with body like this :

{​ "HealthCloudGA__GivenName1__c" : "Tex",  "HealthCloudGA__FamilyName1__c" : "Willer", 
  "HealthCloudGA__BirthDate__c" : "1853-07-07" }

Upon execution, I get following response : JSON_PARSER_ERROR, message: Unexpected character ('â' (code 226)): was expecting double-quote to start field name at [line:1, column:5]

I have also tried with no data in body (empty curly braces), and I got same result, with mention of same strange character â. It's only when I pass pure "{}" string as body, without any spaces, when request gets handled correctly. Is this a bug in Workbench itsself, or do I miss something ?

5
  • Once I also have the same issue for one of the name fields. I found one article which says "In JSON specification, it requires the use of double-quotes for field names. To enable Jackson to handle the unquoted field name, add JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES in the ObjectMapper configuration."In JSON, unquoted field names are non-standard and should be avoided. Let me know if this helps. Nov 27, 2019 at 12:43
  • 1
    Also try validating the JSON here jsonlint.com, because I am getting an Error: Parse error on line 1: { ​ "HealthCloudGA__G --^ Expecting 'STRING', '}', got 'undefined'. when I am pasting your JSON here to validate. Nov 27, 2019 at 12:53
  • You are right, I really had such character in my json, and none of my editors have showed it to me. But jsonlint.com did. Thanks. Nov 27, 2019 at 13:19
  • Dragan or Pranav, do you want to post an answer so this question can be resolved? Thanks!
    – David Reed
    Nov 27, 2019 at 19:00
  • @DraganJovanović please mark a comment as useful if that helps you so that it could be marked as resolved. Nov 27, 2019 at 19:05

1 Answer 1

0

Wrapping up as an answer : "In JSON specification, it requires the use of double-quotes for field names. To enable Jackson to handle the unquoted field name, add JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES in the ObjectMapper configuration."In JSON, unquoted field names are non-standard and should be avoided.

Also try validating the JSON here jsonlint.com, because I am getting an Error: Parse error on line 1: { ​ "HealthCloudGA__G --^ Expecting 'STRING', '}', got 'undefined'. when I am pasting your JSON here to validate.

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.