Questions tagged [jsongenerator]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
46 views

Unable to parse JSON with list

Currently, I'm trying to access JSON with the list included, but when I tried to access the organization from the matches list it's saying variable doesn't exist. Please let me know how to fetch the ...
Pavan tej's user avatar
  • 1,439
1 vote
1 answer
571 views

Parse a nested JSON in a list/array to display it in a table in LWC

Below is my JSON and I want it to parse and display the contents in a table in LWC like below. I used the JSONtoApex tool to create the parser class but I am not getting in which format I should ...
Raham's user avatar
  • 33
0 votes
1 answer
1k views

Test Class Error - System.QueryException: List has no rows for assignment to SObject json | Cover JsonGenerator in Test Class

"Hello everyone" I have a week with this problem in the testClass. So the problem is the following: System.QueryException: List has no rows for assignment to SObject json. The problem comes ...
Alex Barón's user avatar
-2 votes
1 answer
44 views

Fatal Erro: Malformed JSON: Expected '{' at the beginning of object

I need help please, how do I make a template class for this Json, I've tried several ways but I'm getting the message that the Json is malformed. [ { "tipo": "PECÚLIO POR MORTE - ...
Célio Xavier's user avatar
-2 votes
1 answer
2k views

How to create JSON Generator with apex in post api [duplicate]

I'm new in Apex and we have a requirement, Need to send a record from Salesforce to an external system using Rest API whenever a record is created in Salesforce, I need to send a couple of SF fields ...
Catherine's user avatar
0 votes
1 answer
376 views

Sending a HTTP Rest Request to Microsoft Graph HTML formatting issues

I'm trying to setup an automated calendar invite using the Microsoft Graph API endpoint and APEX. I have successfully created a HTTPcallout the sends the calendar invite, but i am having trouble ...
Eric Mueller's user avatar
0 votes
1 answer
1k views

How to replace character in a JSON

I have a requirement where i need to create the below JSON - { id: 1, "tags": ["Management"], name: "Amber McKenzie", title: "CEO", img: "https://cdn....
sfdc_to_learn's user avatar
-1 votes
1 answer
39 views

passing JSONGenerator apex value to javascript giving error

I am trying to pass JSONGenerator value to javascript , but in vf page its appearing as new line due to which its erroring out "Uncaught SyntaxError: Invalid or unexpected token" . Why in ...
user2542953's user avatar
1 vote
1 answer
2k views

Avoid exponential while converting Double to String

I was working with integration, where i need to send my internal data to Core system. I have came across a strange issue while converting large number(Double) into JSON. Sales-force automatically ...
NITHESH K's user avatar
  • 2,515
0 votes
2 answers
1k views

How to form JSON with salesforce field values in apex/Salesforce

I have created SF to SF connection to put standard object cross org, getting error related to JSON response as 400 Bad Request. Error as: Unexpected parameter encountered during deserialization: ...
Priya's user avatar
  • 115
0 votes
1 answer
893 views

How to parse this json into apex list of strings containing SpecialName values?

Hey fellow salesforcers, Im a bit stuck parsing specific values from a json into an apex List stringList Using apex (with or without using Json2Apex), how can we parse the following JSON structure to ...
Peter Noges's user avatar
  • 1,100
0 votes
1 answer
507 views

JSON Generator generate the JSON with backslash

I am using the JSON Generator class to create the JSON. but in response backslash get added. Result: "{\"Id\":\"a171j000000WDQCAA4\",\"Name\":\"Q-00123\"}&...
user3652558's user avatar
0 votes
1 answer
1k views

System null argument for JSON generator.Writestringfield()

I'm unable to run the below code as it throws me an exception null argument for JSONgenerator.writestringfield(), i tried adding multiple where clauses to check null exception for Reported first name, ...
Saaki's user avatar
  • 55
-3 votes
1 answer
861 views

Sending Salesforce fields in JSON to external system Json generator [duplicate]

I have less experience in coding. I have a requirement to send Salesforce record to External system whenever we create a record in SF, create an incident in External system. I wrote a class and a ...
Salman Shaik's user avatar
0 votes
1 answer
3k views

Json generator with list of records from Salesforce

I'm new in Apex and we have requirement, I need to send a record from salesforce to external system using Rest API whenever a record is created in Salesforce, I need to send couple of SF fields to ...
Salman Shaik's user avatar
0 votes
0 answers
884 views

Not able to pass Integer in JSONParser

I am passing the integer value in JSON test class, however the test class is failing with this exception. System.JSONException: Current token (VALUE_STRING) not numeric, can not use numeric value ...
mvk1991's user avatar
  • 535
0 votes
1 answer
1k views

How to jenerate JSON format using wrapper class?

Please see the below code I have done some modification, @RestResource(urlMapping='/instructionsRestCall/*') global with sharing class InstructionsRestService { @HttpGet global static List ...
Rahul's user avatar
  • 1
0 votes
0 answers
807 views

Issue with JSON Parse With Same attribute names in JSON

Here I have doubt How I Can Parse this JSON on apex and Get the data of "customerPurchaseOrderNumber" numbers, Here problem it is having same name of the json field/atrribute I don't how many it ...
Somu's user avatar
  • 1
0 votes
1 answer
261 views

Apex extracting fields from a trigger to create a custom JSON

I have created a trigger for Order Object and only want specific fields to be pulled from that object to create a custom JSON data structure. I have tried saving the fields that I need from the object ...
Richard's user avatar
  • 165
0 votes
1 answer
94 views

JSON Formatting error

I have a requirement wherein I have to strictly format the body of the request as below. { "body": "* Case Number: 1406800\n* Primary Contact Name: Larry Brown Portal \n* Test:SampleTest" } ...
user28452's user avatar
  • 431
1 vote
1 answer
1k views

How do I fix an invalid request in JSON format?

I'm trying to send and SMS through serwersms and creation a Callout with JSON. This request works fine: https://api2.serwersms.pl/messages/send_sms.json?username=LOGIN&password=PASS&phone=...
Apelsinova's user avatar
2 votes
2 answers
1k views

why do we use json JSON.createGenerator [closed]

I have a code JSONGenerator gen = JSON.createGenerator(true); I am not exactly getting an understanding of this line. The next lines use gen.writeStartObject(); gen.writeStringField('tName', ...
user75937's user avatar
  • 299
0 votes
1 answer
3k views

Removing Extra Bracket From JSON:

I need to remove the extra bracket from the JSON Body which i am sending in a Request: Please find the JSON in below: [ { "securianDocNumbers":["3790772","3790771"], ...
user avatar
2 votes
1 answer
11k views

System.JSONException: Can not write a field name, expecting a value [duplicate]

Im struggling with JSON generator for making a HTTP request public String zendeskCalloutManager(string description, string keyToVerify){ // define a response to caller String outcomeMsg; ...
Adnan Zahry's user avatar
1 vote
2 answers
106 views

rest api dynamic json building, i'm trying to get "parent_codes": ["63"],below response is giving line breaks

{ "description": "Core", "code": "Core", "Active": true, "category_Type": "campaign_category", "parent_codes": [ "63" ], "parent_Type": "sub_brand" } here i'm ...
priya n's user avatar
  • 25
0 votes
1 answer
412 views

Variable does not exist: Name

string objectname; List<sobject> objList; for(Schema.SObjectType reference : fldResult.getReferenceTo()) { ...
priya n's user avatar
  • 25
-1 votes
1 answer
168 views

Validation on fields results by a SELECT query

I need to make a validation of the results query of many fields. Today this validation is being made one by one, in such effort that, in my opinion, could be less if we used a function and a list or ...
isadora's user avatar
0 votes
1 answer
338 views

JSON generation in apex batch - how to correctly configure cc in email sending

Below is my code that my batch calls to create JSON to call and send emails through sendgrid. I am trying to loop through the list of contacts and add them to the CC object's array. i have attempted ...
Logie C's user avatar
  • 123
0 votes
1 answer
146 views

alternative way to traverse through json lists of lists of lists in apex

I have the attached json structure and just wondering is there a better way to traverse through the items to obtain them ? whatever i am doing is working and is shown below , but just would like to ...
user2945545's user avatar
0 votes
0 answers
196 views

how to deserializeuntype list<object>?

I have below JSON, that we are getting from external system and I am trying to use json.deserializeUntype to associate it to respective maps, objects etc. And then trying to insert into respective ...
user2945545's user avatar
0 votes
1 answer
800 views

JSON with backslash for CURL. Not able to generate Apex request class

I have a request JSON that other system has given to use. It looks like below: { \"list\": [ { \"m1\": \"tval\", \"fill\": { \"tool\": \"4535\" }, \"respfield\": ...
SfdcBat's user avatar
  • 4,751
3 votes
1 answer
25k views

Unexpected character ('a' (code 97)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

I have a batch class which makes a call out to an api within the same org (the rest resource was developed by a 3rd party supplier and I cannot see its source code) Anyway, as per the supplier the ...
SFDC_Dev's user avatar
  • 293
-3 votes
1 answer
434 views

Issue executing references in separate JSON2Apex class

I'm running into obscure issues while executing my Apex code that calls references from a separate JSON2Apex class and I can't figure out where I went wrong. JSON2Apex class: public virtual class ...
xorLogic's user avatar
  • 155
1 vote
1 answer
799 views

Not sure what to do next with JSON2Apex generated output

I'm not sure what to do next with my JSON2Apex generated output since I only need to see the values for three JSON keys. My generated output is approximately 300 lines long and below is a snippet of ...
xorLogic's user avatar
  • 155
0 votes
3 answers
989 views

JSON.exceptions when inserting JSON objects inside a larger whole

I'm strongly considering going the JSON.serialize route suggested here, but before I do, I thought I'd throw this up here. (I prefer JSONGenerator, in theory, because I can specify the field names, ...
Duncan Stewart's user avatar
3 votes
1 answer
15k views

JSONError - System.JSONException: Can not start an object, expecting field name

I would like to create JSON as a output, for that I have written one sample code, but in that code on line no 30 I am getting error as, 'System.JSONException: Can not start an object, expecting field ...
Amol Jadhav's user avatar