• Ranlou
  • NEWBIE
  • 0 Points
  • Member since 2012

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

I am trying to receive a JSON string in salesforce by converting a blob in the body of an Http request. However, when I convert the blob to a string, \ characters get inserted before the quotation marks, which prevents me from parsing.

I tried to take the string and remove all \ characters by using the string.removeAll() method... but that didn't work either.

 

    RestRequest req =RestContext.request;
   
Blob jsonBlob = req.requestBody;
   
String jsonString = jsonBlob.toString();
   
return jsonString;


The original string (the one that is received as a blob) looks like this:

 

    {"putTimeCard":{"timecard":{"timeCardID":"","employeeID":""}}


And after converting to a salesforce string and assigned to the jsonString is altered to:

 

    {\"putTimeCard\":{\"timecard\":{\"timeCardID\": \"\",\"employeeID\": \"\"}}

 

Has anyone found a solution for this? Thanks

I am implementing a method that receives an authentication token from a user. Based on that token, how can I get the ID of the user that owns the token? The method is being called by an iPhone application. Here is the method declarartion:

 

@future(callout=true)
global static void getItems(String authToken)

 

 

Thanks