cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Transform Data to JSON and then send it to a SQL Table

How can i do this

I used to send the Forms to SQL directly without any intermediate, but now my bosses are asking me
that when de data is send it has to transform to JSON and then send it to an intermediate that transform it again, o now it can be added to the SQL Table.

They say it is for security reasons thta the data must be in JSON format

it can be done with a flow or something like that

7 REPLIES 7
Highlighted
Resident Rockstar
Resident Rockstar

Re: Transform Data to JSON and then send it to a SQL Table

There is a built in JSON function that converts objects to JSON. Here is an example of setting a variable to a JSON value of a collection:

 

Set(jsonString,JSON(yourCollection));

 

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up. 

Highlighted
Helper II
Helper II

Re: Transform Data to JSON and then send it to a SQL Table

AND HOW DO I VALIDATE THAT DATA?

Highlighted
Resident Rockstar
Resident Rockstar

Re: Transform Data to JSON and then send it to a SQL Table

What do you mean exactly? Like check that it's a valid JSON schema? Or validate that the values are correct?

Highlighted
Helper II
Helper II

Re: Transform Data to JSON and then send it to a SQL Table

Both options

Highlighted
Resident Rockstar
Resident Rockstar

Re: Transform Data to JSON and then send it to a SQL Table

I've never run into any reason to doubt the conversion has produced an invalid schema or incorrect values. You can use a validator like the one below to run some tests, but everything should be valid.

https://jsonlint.com/

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Highlighted
Helper II
Helper II

Re: Transform Data to JSON and then send it to a SQL Table

is it possible to validate with a button in powerapps or connect a service to powerapps that validate the JSON

Highlighted
Resident Rockstar
Resident Rockstar

Re: Transform Data to JSON and then send it to a SQL Table

I don't know that the JSON() function is capable of producing invalid JSON schemas. I have never had a problme with an invalid schema from the function. To answer your question, there may be a way to validate it using Power Automate, but I'm not sure. You can post that question on their forums here if you'd like

https://powerusers.microsoft.com/t5/General-Power-Automate/bd-p/MPAForum

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,650)