Extracting specific data/items from JSON

Hey. Morning.

I have a JSON file from an HTTP request that brings me items like this:

{
“numdoc”: “XYZ”,
“session”: “Date”,
“text”: “text description”,
“events”: [
{
“type”: “abc”,
“fields”: {
“field1”: “”,
“field2”: “”
}
}]
}

I would like to create a list of numdoc’s (Google Sheets is fine) if I have two values (and their variances) as part of the text in the “text”: “text description”.

How can I do this?

1 Like

Welcome to the Make community!

Your question is unclear on what you want to extract and in which format?

Please take a screenshot of example spreadsheet with the above example variables in there.

I would suggest completing the Make Academy before jumping into building a complete scenario. If you need specific assistance when you are building a scenario it’s easier to help you then. Otherwise, you can also hire a professional by posting a request in the Hire a Pro category.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

Getting Started

Help Centre Basics

Articles & Videos

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Hi @andremoura

Could you please elaborate your problem?

Regards,
Msquare Automation - Gold Partner of Make
@Msquare_Automation

For now, I need to save the numdoc’s in as a list on Google Sheets.

teste.json (1.6 MB)

1 Like

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of three modules:

This is just an example. Your final solution may or may not look like this depending on your requirements.

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":62,"module":"builtin:BasicFeeder","version":1,"parameters":{},"mapper":{"array":"{{61.data[].arquivamentos}}"},"metadata":{"designer":{"x":170,"y":-1948}}},{"id":63,"module":"builtin:BasicAggregator","version":1,"parameters":{"target":"64.rows","feeder":62},"mapper":{"values":["{{62.numdoc}}","{{62.sessao}}","{{62.texto}}","{{map(62.eventos; \"tipo\")}}"]},"metadata":{"designer":{"x":414,"y":-1951}}},{"id":64,"module":"google-sheets:addMultipleRows","version":2,"parameters":{"__IMTCONN__":95013},"mapper":{"spreadsheetId":"1HarlLjxYu8BzkXZS8FUcZJ7C91yJlIASG_JtJpVRoks","insertUnformatted":false,"valueInputOption":"USER_ENTERED","insertDataOption":"INSERT_ROWS","correctRange":false,"sheetId":"a","tableFirstRow":"A1:Z1","rows":"{{63.array}}"},"metadata":{"designer":{"x":657,"y":-1952},"parameters":[{"name":"__IMTCONN__","type":"account:google","label":"Connection","required":true}]}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like

Amazing. Thanks.

I know it’s not part of the question, but I just noticed the numdoc’s contain special characters. I only need the numbers. To clean them, should I add a text parser before the array aggregator with a regex?

In the Array Aggregator’s column field (wherever you want to map the numdoc variable),

You can use the built-in function replace to remove everything except numbers.

e.g.:

{{ replace(1.variable; "/\D+/g"; emptystring) }}

(paste directly in the field)

For more information, see the function documentation in the Help Center.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

1 Like

I don’t have a field to paste your code, @samliew

You need to select the “Target Structure Type” field first.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

Thanks, @samliew. Worked perfectly.