hi and welcome in another episode of cloud in five minutes
today I want to show you how to use JSON
file in your logic app also if you prefer
I have a French version of this video you just need to click in the top right corner
hello again let me introduce myself I'm Frank Boucher Microsoft Azure MVP based
at Montreal today I want to show you how you could read parse and use adjacent
file inside the logic app let's get started okay so we are already in a
letter gap inside the azure portal the final one I used today is a JSON file
that I use in my reading notes that I publish every Monday so it's mostly
different properties and we want to loop through the cloud so those nodes and
extract the tags and write a file for every one of them
so our logic app will be trigger when we drop the file in a folder so for that I
will use onedrive but of course you can use any other file structure so we need
to special we need to set our folder Clawd and five perfect not I have my
file what I want to do is parse that JSON file so we have now a property
called Jason and in data operation we have the parse that we'll use
parched parse Jason we click on that ok to parse the file we need a schema so I
used to take my my my Jason and use this website jason schema that net paste it
here and generate a schema now it's possible to do it right away in the
portal see this little link here you click here and you pace your decent file
will automatically generate a schema for you so now what we need to do is parse
the file so I cannot use the file directly we need to setup correctly so
we'll write an expression yes so it will use here the expression and if we scroll
a little bit we'll see Jason so we'll sue Jason and then we want to
add the file content Sardi our expression is Jason trigger body
by doing that will transform our file in a JSON object perfect now before setting
up a loop we need a counter so the file will it will be generating a new file
every time to do that we can now create a variable here and we want to
initialize it initialize variable let's call it counter well the type will be
integer and the initial value will be one perfect now we are ready to do a
loop so to do that we'll go and click on the more here and do add for each we
want to iterate through the cloud since this was my collection one important
step here is to limited the parallelism by default logic app is able to run
multiple instances to get better performance but an inner case right now
if we do that since the counter is local it won't work so we need to remove that
so go in settings turn it off and we'll set 1 as the degree of parallelism okay
now we need to add one action and we'll create a file so anyone drive I want to
use I want to create a file so again we need to specify our folder perfect the
file name will be tags underscore and then my counter
txt and the content will be that's another thing now we need to set up the
expression again and what we want to do is the expression item and set it to use
a property tags Y tags because that was exactly the property names that I was
using perfect one last we need to increment our variable so again we go
and search for a variable and in here we should have increment so increment now
from the drop-down pick your variable and add one perfect now everything is
set we're ready to test okay this is my folder and I will copy paste my file
oops know before we need to run it so I click on the Run button so now it's
waiting for my file so put it that way
perfect everything run and if I go in the done I can go open it in Visual
Studio code and will see all my file are right are generated with different tags
that's it guys in few clicks only I was able to take a decent file transform it
in a decent object so I can parse it and then use it in a next video I will show
how to use this content and pass it to manager function you should subscribe to
be sure to not miss it I hope you like this video and I hope you is useful be
sure to give me a thumbs up if it's the case see you next time bye
you