+ Start a Discussion
nayana pawar 3nayana pawar 3 

Insert new records in to custom object from json string in salesforce.

I am working with the new JSON Parsing functionality,
I have API URL that contain json string.I have created one VF page that displays JSON string data in pageblock table in record format from API URL.
Now i want to insert that json string into custom object records. How can I insert new records fron json string to my custom object.
amidstcloudamidstcloud
Nayana

You can deserialize the Json string .  Visit Below URL to learn more.  I can suggest you better if you share your json string. 
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_class_System_Json.htm

nayana pawar 3nayana pawar 3
My JSON String = '[{"id":"1","name":"Karura","username":"karura","password":"0001","supplierid":"3","pin":"pin","location":"Kiambu","telephone":"398886887","email":"karura@gmail.co","gender":"1","type":"1","lastLogin":"1411471942","createtime":"0","salesforcestatus":"1"},{"id":"2","name":"Wangige","username":"wangige","password":"0002","supplierid":"3","pin":"pin","location":"Kiambu","telephone":"986887","email":"kkkhkkh@gmail.c","gender":"1","type":"1","lastLogin":"1411471453","createtime":"0","salesforcestatus":"1"},{"id":"3","name":"Kahuho","username":"kahuho","password":"0003","supplierid":"3","pin":"pin","location":"","telephone":"","email":"","gender":"0","type":"1","lastLogin":"1411216631","createtime":"0","salesforcestatus":"1"},{"id":"4","name":"Ndenderu","username":"ndenderu","password":"0004","supplierid":"3","pin":"pin","location":"","telephone":"","email":"","gender":"0","type":"1","lastLogin":"1411462795","createtime":"0","salesforcestatus":"1"},{"id":"5","name":"Kibiku","username":"kibiku","password":"0005","supplierid":"3","pin":"pin","location":"","telephone":"","email":"","gender":"0","type":"1","lastLogin":"1399623798","createtime":"0","salesforcestatus":"1"},{"id":"6","name":"Karuri","username":"karuri","password":"0006","supplierid":"3","pin":"pin","location":"","telephone":"","email":"","gender":"0","type":"1","lastLogin":"1411465199","createtime":"0","salesforcestatus":"1"},{"id":"7","name":"Kwamaiko","username":"kmaiko","password":"0007","supplierid":"3","pin":"pin","location":"","telephone":"","email":"","gender":"0","type":"1","lastLogin":"1411400718","createtime":"0","salesforcestatus":"1"}]';
Arunkumar RArunkumar R
S S MalikS S Malik
Use this link It will definatly help you

http://nanostuffs.com/Blog/?p=1722

Please share if you have any other solution for the same problem
JaanuJaanu
I have looked at the full code @ https://www.soliantconsulting.com/blog/salesforce-sandboxpostcopy-interface

can you pls give me high level code to update custom settings from json file in apex class. Pls let me know.