Help Needed: Structuring Website Form Data into a JSON Array

Hey Make Community! :wave:

I hope you’re all doing well! I’m working on a project where I need to extract information from a WordPress website form into a structured JSON array, and I’m really hoping to get your help to figure out the last piece of the puzzle.

Here’s What I’m Trying to Do:

I’ve got a WordPress form that users fill out, which includes a list of products with various specifications. The tricky part is that all the product information is grouped together in a long text string under the field "your-order". My goal is to take that data, parse it, and turn it into a neat JSON structure like this:

{
“firstName”: “John”,
“lastName”: “Doe”,
“telephone”: “1234567890”,
“email”: “john.doe@example.com”,
“company”: “ExampleCorp”,
“address”: “123 Example Street”,
“city”: “ExampleCity”,
“state”: “ExampleState”,
“order”: [
{
“productType”: “Window”,
“productName”: “Model X Hinged Window”,
“corners”: “Mitered”,
“paint”: “Silver”,
“glassTint”: “6mm 1/4" 44% grey”,
“windowType”: “N/A”,
“width”: “45”,
“height”: “32”,
“quantity”: “2”
},
{
“productType”: “Door”,
“productName”: “Model Y Insulated Door”,
“corners”: “4" Radius”,
“paint”: “Black”,
“glassTint”: “6mm 1/4" 44% grey”,
“windowType”: “Slider”,
“width”: “56”,
“height”: “78”,
“quantity”: “1”
}
]
}

The amount of ordered products may vary, so that’s another tricky part for the JSON structure.

What I’ve Accomplished So Far:

  • I’ve successfully parsed the "your-order" data using Make’s text parser modules, and I can now extract the product information into an array.
  • Each product’s details (like type, name, dimensions, etc.) are now neatly organized into individual elements.

Where I’m Stuck:

I’m having trouble combining everything into a final JSON structure that includes both:

  1. The general customer details (first name, last name, etc.).
  2. The array of products, where each product’s details are correctly organized as individual objects.

The final JSON needs to look like the example above, with the "order" array dynamically handling 1 to many products.

What I’m Looking For:

I’d be super grateful for any advice, tips, or guidance on how to create this complete JSON structure, especially the part where I bring together the customer details with the dynamically generated product array.

Thank you all so much in advance—I really appreciate any help you can offer! :pray: I’ll be adding some screenshots to show what I’ve done so far and where I’m stuck.

Looking forward to hearing your suggestions! Thank you so much!

Someone else who loves Text Parser modules might be able to help with those.

My suggestion is different: if you got “product information is grouped together in a long text string” and you want to coerce it into a structured object, perhaps ask an LLM like OpenAI or Groq to do it. It’s pretty good at generating JSON objects in the structure you’d like.

There is a Groq “Create a JSON Chat Completion” module for JSON outputs (bit of an explanation about this module starts here at https://www.youtube.com/watch?v=Qp6znB5juU8&t=635s.

And OpenAI too has a response_format of json option that you can investigate.

Finally, OpenAI recently released Structured Outputs https://openai.com/index/introducing-structured-outputs-in-the-api/ and I made a vid about how to use this via HTTP module until its one-day built into the OpenAI modules https://www.youtube.com/watch?v=q4G-YHJmTnw

Ooh, I see there is an OpenAI module “Transform Text to Structure Data” which I hadn’t notice before. Perhaps it is for the new Structured Outputs feature above.

Oh this is great. Like the Groq JSON module, it produces data that is already parsed ready for us by Make. No “Parse JSON” module required.

Looking at the API traffic of this module via Make DevTools, it is not yet using the new Structured Outputs feature (with 100% guarantee of JSON format), but it is very nice to have found.

1 Like

Hi drnic! Thank you so much!

This looks really good and I’ll give it a try. I was aiming to avoid AI for this workflow, since I prefered ensuring 100% accuracy for data extraction. But I’ll definitely give those structured outputs a chance. Thanks!