1051,1052 Json Objects/Array Loops

More
1 year 6 months ago #24772 by prashant
HI , 
The current JSON/array object used in example

{   "name": "John Doe",   "age": 30,   "email": "johndoe@example.com",   "isStudent": false,   "address": {     "street": "123 Main St",     "city": "New York",     "zip": "10001"   },   "hobbies": ["reading", "gaming", "traveling"] }

Can I iterate through the above example by hobbies ? So 1 loop per hobby ? Either by flattening or per object 

FLATTENING HOBBY

[
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "reading"
  },
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "gaming"
  },
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "traveling"
  }
]

OR 1 HOBBY OBJECT PER JSON
[
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "reading"
  },
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "gaming"
  },
  {
    "name": "John Doe",
    "age": 30,
    "email": "johndoe@example.com",
    "isStudent": false,
    "address": {
      "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
    },
    "hobby": "traveling"
  }
]
 
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
1 year 6 months ago - 1 year 6 months ago #24774 by admin
Sure you can.

You just loop over JSON Object/Arrray  and use "Get JSON Object Property Dynamic Action" to extract property value

www.etl-tools.com/wiki/advanced-etl-proc...ect-property-action/   

Mike
ETL Architect
Last edit: 1 year 6 months ago by admin.

Please Log in or Create an account to join the conversation.

More
1 year 6 months ago #24775 by admin
In fact new ChatGPT example does exactly that.


Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
1 year 6 months ago #24780 by prashant
HI,
Can I request for an example of the transformation in above case (both if possible)
---

Some Feedback on the new HTTP Properties
1. Spelling of Headers is wrong. please see screenshot
2. In Parameters -> if body type is JSON , shouldn't headers automatically have a header of content-type - application/json . Similar for body type - text , content-type application/json ???

 
 

Please Log in or Create an account to join the conversation.

More
1 year 6 months ago #24782 by admin
1 Can I request for an example of the transformation in above case (both if possible)

This example already exists in the latest repository. 2001 ChatGPT Chat

2 We will correct spelling mistake

3 HTTP Action can be used to test http requests similar to "Postman".
So basically in most of the cases you can enter anything you want.
But during execution the parameters from parameters tab are used   

4. In Parameters -> if body type is JSON , shouldn't headers automatically have a header of content-type - application/json . Similar for body type - text , content-type application/json ???

It is added automatically during execution.
 

Mike
ETL Architect

Please Log in or Create an account to join the conversation.

More
1 year 6 months ago - 1 year 6 months ago #24788 by prashant

3 HTTP Action can be used to test http requests similar to "Postman".
So basically in most of the cases you can enter anything you want. But during execution the parameters from parameters tab are used   

OK like running transformation and packages. 

admin post=24782 userid=621 Can I request for an example of the transformation in above case (both if possible)
This example already exists in the latest repository. 2001 ChatGPT Chat

I understood the part of going through the JSON and then iterating the structure , to display response from chatgpt , but how to flatten the structure of entire json without code is what I dont' understand yet

Question


IN example , I assume for sake of clarity , you are iterating JSON structure slowly from Choice->message->content , can't this be achieved in 1 single Get JSON Object property ? 
Last edit: 1 year 6 months ago by prashant.

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save