I'm an awful programmer and trying to parse a JSON payload response for an integration. Willing to pay Fg for anyone who can write the snippet of code that will parse this sample payload:
Code
{
attributes: [
{
handle: 'email',
name: 'Email',
value: 'john.doe@gmail.com
},
{ handle: 'fname', name: 'First Name', value: 'John' },
{ handle: 'group', name: 'Group Association', value: null },
{ handle: 'lname', name: 'Last Name', value: 'Doe' },
{ handle: 'zip', name: 'Postal Code', value: '45383' },
{
handle: 'id',
name: 'Unique Identifier',
value: '534534535'
}
],
status: [ { group: 'student', subgroups: [Array], verified: true } ]
}
The array is being stored as variable bodyParse
Code
let bodyParsed;
try {
bodyParsed = JSON.parse(body);
} catch (jsonError) {
return callback(new Error(body));
}
The code must identify if the "name" exists in the payload, and if it does, fetch the value of that array and store it as a variable.
Expected Outcome:email = john.doe@gmail.com
fname = john
lname = Doe
zip = 45383
group = student
verified = true
This post was edited by Ryans on Aug 9 2022 02:01pm