function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
smita bhargavasmita bhargava 

split json data fields

I am getting json data from an external webservice. The format of json data is as follows.
      Fullname=Michael$stone
      homephone=239923923 
I need to map the firstname and lastname to the Lead object standard fields.
so firstname=Michael and lastname=stone.

so my query is how to split the fulname in json data and then store into lead object fields.

Thanks
Smita B
 
Best Answer chosen by smita bhargava
GauravGargGauravGarg

Hi Smita,

As describe above, if you JSON is providing you data in format of FirstName$LastName then straight forward use String.Split() method

i.e.List<String> name = fullname.Split('$'); 
put name[0] in First Name, name[1] in last Name. 

Hope this helps!!!

Thanks,

Gaurav
Skype: gaurav62990