You need to sign in to do that
Don't have an account?
Kumar5
wrapper class to map json to salesforce
Wrapper class for mapping JSON Values
Hi Team,
I am workin on Webservices where i need to map json to salesforce.
Please help me with the sample code for following json {
"QuoteLineItem": [
{
"REQ_ID": "055",
"QUANTITY": "21168.000",
"ITEM_UNIT_PRICE": "292.48",
"REQ_PRICE_PER": "100",
"STATUS": "8",
"UOM": "PC",
"CURRENT_PRICE": "292.48",
"ITM_NUMBER": "000001",
"CURRENT_PRICE_UOM": "PC",
"MATERIAL": "5-103669-3"
},
{
"REQ_ID": "055",
"QUANTITY": "21168.000",
"ITEM_UNIT_PRICE": "292.48",
"REQ_PRICE_PER": "100",
"STATUS": "8",
"UOM": "PC",
"CURRENT_PRICE": "292.48",
"ITM_NUMBER": "000001",
"CURRENT_PRICE_UOM": "PC",
"MATERIAL": "5-103669-3"
}
],
"QuoteHeader": {
"POS_REGION": "",
"NET_VALUE": "0.00",
"END_ACCT": "",
"REC_VERSION": "02",
"REQUESTOR_NAME": "",
"REQUESTED_DATE": "00000000",
"PARTDETAILS_CNT": "100",
"REQUESTOR_EMAIL": "",
"EFFECTIVE_DATE": "20160713",
"BRANCH_ID": ""
},
}
public class QuoteWrapper {
tried this the below one but getting Unknown field: QuoteWrapper.QuoteLineItem
public class QuoteWrapper {
public class QuoteHeader{
public String CUST_REF_NO {get; set;}
public string SALES_OFFICE {get; set;}
public Integer invoiceNumber {get; set;}
public List<quotelinteitem> quotelinteList {get;set;}
}
Public Class quotelinteitem{
Public String QUANTITY;
}
public List<QuoteHeader> QuoteList {get; set;}
}
Thanks,
Kumar
Hi Team,
I am workin on Webservices where i need to map json to salesforce.
Please help me with the sample code for following json {
"QuoteLineItem": [
{
"REQ_ID": "055",
"QUANTITY": "21168.000",
"ITEM_UNIT_PRICE": "292.48",
"REQ_PRICE_PER": "100",
"STATUS": "8",
"UOM": "PC",
"CURRENT_PRICE": "292.48",
"ITM_NUMBER": "000001",
"CURRENT_PRICE_UOM": "PC",
"MATERIAL": "5-103669-3"
},
{
"REQ_ID": "055",
"QUANTITY": "21168.000",
"ITEM_UNIT_PRICE": "292.48",
"REQ_PRICE_PER": "100",
"STATUS": "8",
"UOM": "PC",
"CURRENT_PRICE": "292.48",
"ITM_NUMBER": "000001",
"CURRENT_PRICE_UOM": "PC",
"MATERIAL": "5-103669-3"
}
],
"QuoteHeader": {
"POS_REGION": "",
"NET_VALUE": "0.00",
"END_ACCT": "",
"REC_VERSION": "02",
"REQUESTOR_NAME": "",
"REQUESTED_DATE": "00000000",
"PARTDETAILS_CNT": "100",
"REQUESTOR_EMAIL": "",
"EFFECTIVE_DATE": "20160713",
"BRANCH_ID": ""
},
}
public class QuoteWrapper {
tried this the below one but getting Unknown field: QuoteWrapper.QuoteLineItem
public class QuoteWrapper {
public class QuoteHeader{
public String CUST_REF_NO {get; set;}
public string SALES_OFFICE {get; set;}
public Integer invoiceNumber {get; set;}
public List<quotelinteitem> quotelinteList {get;set;}
}
Public Class quotelinteitem{
Public String QUANTITY;
}
public List<QuoteHeader> QuoteList {get; set;}
}
Thanks,
Kumar
Greetings to you!
Below is the sample code.
Please check below tools for JSON to APEX.
https://json2apex.herokuapp.com/
https://www.adminbooster.com/tool/json2apex
http://json2apexengine.somee.com/
Also, please refer to below link which might help you further.
http://blog.deadlypenguin.com/blog/2015/11/30/json-deserialization-in-salesforce/
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas