Transform JSON into wanted fields

,

Hello everyone,

I am currently working on retrieving specific fields from the blueprint API call. The API call can be made using the following URL: https://eu1.make.com/api/v2/scenarios/SCENARIO_ID/blueprint. When this call is made, it returns a large amount of information from the scenario blueprint, which can be used for exporting or importing.

However, my objective is to extract only the essential items from the JSON response, and then send it to either OpenAI or Anthropic, depending on the number of tokens involved. The purpose is to generate documentation for the scenario itself or at least provide an explanation of the scenario.

I am encountering difficulties when it comes to mapping the data. Inside the “blueprint.flow” section, there is an array of modules, and within each module, there are several collections. The only information I require is located inside the “mapper” collection, while excluding metadata and parameters. Since blueprints can have numerous variations, it is not feasible to map each value individually or solely focus on the “mapper” collection (refer to the screenshot).

Therefore, I am seeking guidance on how to transform the data into my own JSON format, where I can exclude all the ‘unnecessary’ fields. This is necessary because the extensive amount of data either consumes all available tokens or confuses the AI due to its complexity.

Any help would be appriciated

Hi @NWE,

Not sure what your exact use-case looks like, Working with JSON whose data structure is not predefined can be tricky, and am not sure if that is achievable. However, If you know beforehand the structure of JSON you will have in your module then what you can do is,

  1. From the Blueprint response, Fetch all the Mapper that has the module as http:ActionSendData, To do this, you can directly use the map function and then in filter simply use if contentType is application/json. We can do that with another map but it will be tricky to do so.

{{map(1.data.flow; “mapper”; “module”; “http:ActionSendData”)}}

Here data.flow will be yours blueprint.flow.

  1. Add a filter in between to check if contentType of the iterator result is application/json
  2. Afterwhich, Add a Parse JSON module, that you can use to parse the data body.

Your scenario will look something like this,

Screenshot from 2023-05-22 15-54-49

1 Like

Thanks for explaining but I think that is the issue like you wrote

Working with JSON whose data structure is not predefined can be tricky, and am not sure if that is achievable. However, If you know beforehand the structure of JSON you will have in your module then what you can do is

I don’t know the structure of the JSON since I would like to do this with all my scenarios, and the possible JSON is as many modules as Make.com has integrations with