Building JSON Objects in Microsoft Flow
A couple of days ago, I was helping a friend with a case in Microsoft Flow ... So I thought this is a good time to write a new article that would be a reference for my friend, and hopefully others would find this useful if they came across the same issue.
The Case
It's very simple and straight forward, we have a flow that gets initiated once an item is added to a SharePoint list, and we want to return a JSON object of the newly added item ... Easy!
Good to know...
Now before going into the solution, it's good to know that Microsoft Flow itself handles data within as JSON, whereas Flow is not only a process automation service, it's an integration service as well. Therefore it needs a common ground/language/format - you name it - to handle all data types from all the different sources (SharePoint list, SQL Table, Excel, etc...)
This is How...
Well, there are two different ways to tackle the case above, and I'm going to list them both in this article.
For the sake of easy illustration in this article, I have created a custom list in SharePoint called "Creative Ideas" and it has two columns (Title and Description)...
Solution 1
If you are familiar with Flow, you'll know that when an action or a trigger is created there are a set of various properties (Dynamic content) that are associated with each Flow building block, and in our case the newly added item properties are returned along with the trigger. So we can use them to build our JSON.
As we can see from the figure above, we've added an "Initialize variable" action right after the trigger, and we have built the JSON object manually in the initial value field. The output value of the variable should look something like this:
1: {
2: "Title":"JSON 123",
3: "Description":"JSON description"
4: }
Solution 2
The following solution is as clean and neat as the first one, however it involves another call to the SharePoint list which could be an overhead in some cases.
From the figure above, notice that we have added the "Get items" action after the trigger, and then we are filtering the action by ID to return only the correspondent item with the trigger (the added item). At this point, notice that we could have returned the "value" property available from the "Get items" action (which is JSON), however we want the JSON to look as clean and neat as solution 1.
In the last action, we have added the "Select" action from the data operations action group, and then provided the "value" property as the field input form "From" (which is expecting a JSON object) and then we have mapped the properties we want to appear in the newly created JSON object (current action). The JSON output would look exactly as the one from solution 1.
Note: Title and description are from the "Get items" action, NOT from the trigger properties. This way the flow would work whether we are returning one item or multiple items.
I hope this helps! Enjoy...
Hi Ahmad. Thank you for this great tip. I am new to Flow and I have to find a way to export Sharepoint List entries as JSON and this was very helpful. Now I have a question. This JSON object from your very last step 'select' - how can I save it as file or how can I upload it elsewhere with SCP?
ReplyDeleteYour post is in very organized way and easily understandable. Doing a good job. Thank you for sharing this content
ReplyDeleteAwesome and really very nice to see this post
ReplyDeletedata science training in bangalore
best data science courses in bangalore
data science institute in bangalore
data science certification bangalore
data analytics training in bangalore
data science training institute in bangalore
awesome its really good post
ReplyDeletedata science training in Marathahalli
best data science courses in Marathahalli
data science institute in Marathahalli
data science certification Marathahalli
data analytics training in Marathahalli
data science training institute in Marathahalli
Awesome Blog..
ReplyDeletedata science training in BTM
best data science courses in BTM
data science institute in BTM
data science certification BTM
data analytics training in BTM
data science training institute in BTM
how to i load all the items into one JSON object?
ReplyDeleteUse this diet hack to drop 2 lb of fat in just 8 hours
ReplyDeleteWell over 160000 women and men are using a simple and SECRET "liquid hack" to drop 1-2lbs each night in their sleep.
It's proven and works on everybody.
You can do it yourself by following these easy steps:
1) Get a clear glass and fill it with water half the way
2) Now do this amazing hack
and you'll become 1-2lbs skinnier when you wake up!
Superb
ReplyDeleteSAP Training in Chennai
SAP ABAP Training in Chennai
SAP Basis Training in Chennai
SAP FICO Training in Chennai
SAP SD Training in Chennai
SAP MM Training in Chennai
SAP PM Training in Chennai
SAP PP Training in Chennai
SAP MDG Training in Chennai
SAP EHS Training in Chennai
ReplyDeleteHi there everyone, I have come across almost all the web development sites. However, your website is far better than other in form of content, tools and easiness of using website. Since I am a developer, I am always looking forward to make people aware of web development tools. I can help you people out by introducing you to range of json tools. Here is the link jsononline
Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleteData Science Training Institute in Pune
This information is really awesome thanks for sharing most valuable information.
ReplyDeleteData Science
Python
Selenium
ETL Testing
AWS
ReplyDeleteExcellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well.
Data Scientist Course in pune
We provide Classroom training on IBM Certified Data Science at Hyderabad for the individuals who believe hand-held training. We teach as per the Indian Standard Time (IST) with In-depth practical Knowledge on each topic in classroom training, 80 – 90 Hrs of Real-time practical training classes. There are different slots available on weekends or weekdays according to your choices. We are also available over the call or mail or direct interaction with the trainer for active learning.
ReplyDeleteFor any queries feel free to Call/WhatsApp us on +91-9951666670 or mail at info@innomatics.in
data science training in hyderabad
I'm cheerful I found this blog! Every now and then, understudies need to psychologically the keys of beneficial artistic articles forming. Your information about this great post can turn into a reason for such individuals.
ReplyDeleteServicenow Training in Hyderabad
I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up.
ReplyDeleteLocal SEO Company Uk
Local SEO Agency Gloucester
Local SEO Company
Looking for Home Hero services in in Dubai? At home hero services we have experienced carpenters who provide high-quality customized Home services in Dubai. Besthome service Dubai is one of the best services in the world. And home works in Dubai Is at a high peak nowadays. You can also customize home Dubai service in 2021
ReplyDeletebest carpentry service dubai
Such a nice blog with the reference links. Thanks for sharing with others.
ReplyDeleteSelenium Training In Chennai
Selenium Online Training
Selenium Training In Bangalore
Superb blog post! And this blog clearly explain about for useful information. I would Thanks for sharing this wonderful content. Its very useful to us. Keep it up!
ReplyDeletephp interview questions and answers
php interview questions for freshers
php interview questions for experienced
php basic interview questions
core php interview questions
You can publish your case on your instagram profile and get some followers from here https://soclikes.com/buy-instagram-followers to promote it. What do you think about it?
ReplyDeleteCyber Security in Healthcare
ReplyDeleteThermoplastic Vulcanizate(TPV) Market Status (2016-2020) and Forecast (2021E-2028F) by Region, Product Type & End-Use
ReplyDeleteTHERMOPLASTIC VULCANIZATE(TPV) MARKET
Market Overview
At the beginning of a recently published report on the global THERMOPLASTIC VULCANIZATE(TPV) market, extensive analysis of the industry has been done with an insightful explanation. The overview has explained the potential of the market and the role of key players that have been portrayed in the information that revealed the applications and manufacturing technology required for the growth of the global THERMOPLASTIC VULCANIZATE(TPV) market.
THERMOPLASTIC VULCANIZATE(TPV) market
This comment has been removed by the author.
ReplyDeleteAnyone interested in this subject should use this blog as a resource. Continue the excellent work! You can find out more about CPS Test by reading an article I published. This CPS test is a definite must-take due to the user-friendly UI and simple timeframe.
ReplyDeleteI enjoy your article. I appreciate you giving this knowledge. The sum of a person's assets minus their liabilities, which reflects their genuine financial situation. Browse this profile to find out more information net worth.
ReplyDelete