How to parse JSON in PowerApps? - sharepoint

I have stored JSON data in SharePoint online list multi line and text column. I need to update that column in Power Apps form.
Can anyone help me for how to parse / stringfy the JSON data in Power Apps without using Flow?
Thanks & Regards,
Meet

You can use Power Automate to parse JSON string to Object. Action is named "Parse JSON".
Serializing from Object to string is possible using JSON function in PowerApps:
https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-json

unfortunately you will have to use Power Automte/flow for converting string to Json. Out of box canvas App does not have any method to convert string to json. The closet you can get is JSON function.
Here is nice article of Power Apps (canvas App) with power automate to convert string to JSON

You can actually use MatchAll() to do much of the parsing. Issue is getting the correct RegEx string (in PowerApps format) to do so.

Today Microsoft has provided the function to parse the JSON inside the powerapps itself. It is an experimental feature for now. You can learn more from here:
https://powerapps.microsoft.com/en-us/blog/power-fx-introducing-parsejson/

Power Apps now supports experimental ParseJSON function which might be helpful to you.
Check below links for detailed information:
Power Fx: Introducing ParseJSON
ParseJSON function in Power Apps (experimental)

Related

How to find string in file contents

I'm trying to search for a string in a file that gets uploaded to SharePoint.
I'm using Send HTTP request to SharePoint to get the file content. But $content comes back in Base64 as an object. How would I search for a string in the returned $content ?
/_api/web/getfilebyserverrelativeurl('/sites/mySite/Shared%20Documents/myFileInWordOrPDFformat.docx')/$value?binaryStringResponseBody=true
headers:
{
"accept": "application/json;odata=nometadata",
"content-type": "application/json;odata=nometadata",
"odata-version": ""
}
Returns
{
"$content-type": "application/octet-stream",
"$content": "UEsDBBQAAAAIANZualN4vZl3IWQAAO2wAQARABwAd29-BlahBlahBlah-QQAAPCJAAAAAA=="
}
Posts like-
https://sharepoint.stackexchange.com/questions/273774/how-to-get-content-of-file-in-sharepoint-using-sharepoint-rest-api
https://debajmecrm.com/binary-to-base64-in-microsoft-power-automate-microsoft-flow/
https://linnzawwin.blogspot.com/2021/02/handle-base64-and-binary-file-content.html
have been helpful but I'm still not clear.
Do I need to convert the string I'm searching for to Base64 and search for it that way?
Any suggestions? Also, I don't have the option of utilizing premium connectors.
TIA!
This may not suit you but the way I would do it is to use the Cloudmersive document conversion actions to extract the text. It's a premium connector though so unless your user is enabled, it'll be a blocker.
It's the nicest way I found which can still be free if you don't have the need to call it more than 800 times a month and no more than once a second.
If your requirement exceeds that, you'll have to look at a paid subscription.
I looked at ways of using the SyncFusion PDF functionality in an Azure function which could be paired with the Adobe services to convert the DOCX file to a PDF but it started to become a bit too much effort for an answer in Stackoverflow. The Adobe task was easy, it was the reading of the PDF which became a little too much.
It's still an option though ... https://www.syncfusion.com/kb/7178/how-to-use-pdf-control-in-nodejs-environment
This is an example that allows you to search for text, you'd just need to adapt it using the previous link and those instructions. FYI, the reason for using Node is because C# Azure Functions only support .NET Framework in the V1 runtime which is very much obsolete ... https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions ... and .NET Framework is what's required for the relevant Syncfusion functionality. I'm happy to be proven wrong by someone else in the community though, I could be wrong.
This is what the Cloudmersive connector will do for you ...
Sample Document
Flow
Result
Note: One thing I noticed is that the word "Microsoft" comes out wrong. It's a bit bizarre but you could always take that up with Cloudmersive.

What format is this template string/formula field in?

I am building an integration for a client with the HelloWorks API. This is a service that allows you to create user-fillable PDF forms.
It appears that their product supports formatted/template strings/formula fields as outputs to the PDF files, as when
I create a Date field, it creates an output field with the following data:
#{format(:date, #field_XXXXX, "{0M}/{0D}/{YYYY}")}
However, I cannot find any kind of documentation as to what is the format of this template string/formula field.
In case anyone is still looking for an answer for this, this is what HelloWorks support team has to say.
As for documentation for the format, we do not have any documentation for that at this time and the ability to make those edits are going to be depreciated in the future as our product team wants to bring those capabilities to the portal without custom edits.

Acumatica OData as JSON (instead of Atom)

Does anyone know if it's possible to get an Acumatica OData endpoint to return JSON instead of Atom?
By default, it looks to me like the format is Atom:
But this seems to indicate that JSON might be a possible alternative:
https://www.odata.org/documentation/odata-version-2-0/json-format/
There are two options available:
Use Format System Query Option (just add $format=json to the query string)
If you're doing an integration, you can also request the JSON format using Accept HTTP Header (see this article for more details).

How to pass a very long string/file into RESTWebservice JAX-RS Jersey

I wrote a RESTful webservice using JAX-RS API, that returns an XML string.
I am trying to write another RESTful webservice that takes in this XML string, does parsing of it using DOM and extract particular things I want. The XML string happens to be very long so I do not want to pass it as a #QueryParam or #PathParam.
Say If I write that XML string into a file, How do I go about writing this service that takes in this file, extracts whatever I want and return the results. I am actually trying to extract some number of strings, so my webservice should finally return an array with all those strings.
Could somebody please shed some light on how I should go about doing this.
Thanks in advance
Sashikiran,
not sure I understand this correctly, but you can implement streaming access to the HTTP output and input streams. You need not read or write the whole thing at once.
So, while your read the stream from service A you can extract what you need and write that out to service B via a POST request.
Why are you DOM-parsing the XML? A SAX or StAX parser seems more suitable of the XML is indeed very long.
Jan

How do I aggregate data off of a google search

I am trying to aggregate movie times off of google/movies search into a usable format such as json or xml
http://www.google.com/movies?q=movie+times&sc=1&mid=&hl=en&oi=showtimes&ct=change-location&near=new+york
The Google AJAX api does not seem to work for this as you cannot do a movie search.
Does anyone know how this can be done?
Lookup the technique called web scraping.
Basically, you have to fetch the results page using some server-side scripting, and then extract data from it, to present in a formated way (json, xml, etc). Regular expressions or a DOM/XML parser could help.
This guy has a PHP script that converts Google results to RSS.

Resources