Creating JSON structure - Still don't get it


I’ve read a lot on how to create a JSON structure but I still don’t get it as I need it to be.

I need my JSON to be structured as:

     "operation": "CREATE_OR_UPDATE",
     "users": [
             "properties": {
                 "FirstName": "Jill",
                 "LastName": "Johnson",
                 "MobilePhoneNumber": "9876543",
                 "Upn": "u5627927",
                 "Email": "[email protected]",
                 "AuthenticationType": "DB",
                 "Company": "18337"

And the data (e.g “Jill” and “Email”) should come from the node before.
That data looks like this:

And currently, I’m using the Function node to try and get the correct JSON structure. As it seems that is the node to use in this situation.

The goal is to use this JSON in a body for a Rest Call to create or update users.

Hi @Cizco, could you post the JSON data you currently have as text rather than as a screenshot (you can of course redact the actual values) as well as the Function node you currently have? Happy to take a look at how this could be transformed. Thanks so much!

1 Like


It looks like this:

"@odata.context": "$metadata#users(displayName,accountEnabled,givenName,surname,userPrincipalName,jobTitle,mobilePhone,companyName)",
"value": [
  "displayName": "DonaldDuck",
  "accountEnabled": true,
  "givenName": "Donald",
  "surname": "Duck",
  "userPrincipalName": "[email protected]",
  "jobTitle": "Duck",
  "mobilePhone": "1337",
  "companyName": "AB"
1 Like


The Function node looks like this atm:

Thanks @Cizco! Here’s a quick example workflow performing the transformation:

This is the result:

I’ve made some assumptions about which source field goes into which field of your desired output data structure, so you might need to adjust it a bit.

I’ve added comments explaining each command but if you have any questions on the code snippet please do let me know!

1 Like

Thank you so much @MutedJam !!
It looks great :grin:

Now I have learn the coding/scripting language for this :slight_smile:

1 Like

You are most welcome! The language used here is plain Javascript in case you want to take a closer look :slight_smile:

1 Like