Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:17:30+00:00 2026-06-07T17:17:30+00:00

I am trying to receive a JSON string in salesforce by converting a blob

  • 0

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 there are \ characters that get inserted into the request which prevents me from parsing.

I then tried to take the string and remove all \ characters… 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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:17:32+00:00Added an answer on June 7, 2026 at 5:17 pm

    The JSON Deserializer can parse the string with the escape characters. You can either deserialize into an object like so:

    String jsonString = '{\"putTimeCard\":{\"timecard\":{\"timeCardID\": \"\",\"employeeID\": \"\"}}}'
    Timecard t = (Timecard) JSON.deserialize(jsonString, Type.forName('Timecard'));
    

    or if you just want a map of objects you can do the following:

    String jsonString = '{\"putTimeCard\":{\"timecard\":{\"timeCardID\": \"\",\"employeeID\": \"\"}}}'
    Map<String, Object> m = (Map<String, Object>) JSON.deserializeUntyped(jsonString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm receiving a Json string back from a http request that looks something like
I;m trying to parse a json string which I receive from web server as
I need to convert a string to a JSON object that gets returned from
I'm trying to access a server so I can receive a JSON String. But
I'm trying to send a JSON request to a remote device that then returns
I am trying to receive a json object back from php after sending data
How to extract and save array from string parameter? I'm trying convert string beafore_create
I am trying to json_decode the response I receive from a GET request to
I'm trying to send a HTTP request to a servers interface. But I'm really
I'm trying to use fiddler to generate requests to receive a JSON response. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.