cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Joao_Macau
Frequent Visitor

Connect JSON file

Hello!

 

I'm trying to extract information from a DataModelSchema file of a pbix. I've generated the schema from the content of the DataModelSchema file but the problem seams to be at the "Get file content" step. This the the output information:

 

 

 

 "statusCode": 200,
  "headers": {
    "Pragma": "no-cache",
    "x-ms-request-id": "d2deb01a-cf5c-44b1-bb26-c4b79c3a4fa2",
    "Timing-Allow-Origin": "*",
    "x-ms-apihub-cached-response": "false",
    "Accept-Ranges": "bytes",
    "Cache-Control": "no-cache",
    "Date": "Sun, 14 Feb 2021 15:15:22 GMT",
    "ETag": "\"{92A23D38-3C07-43F9-BE8D-A28274C913DD},1\"",
    "Location": "https://flow-apim-europe-001-westeurope-01.azure-apim.net/apim/onedriveforbusiness/045504c08d7d484d8f9ef1afb82ac804/datasets/default/files/b%252153IHfvcFuUaXGDvmYynlkjdO3XN3crpFpQt9XZKqzPSnRu5ZDPCbSbGg9dJSeL_F.01NUQZS7BYHWRJEBZ47FB35DNCQJ2MSE65/content?inferContentType=false",
    "X-AspNet-Version": "4.0.30319",
    "X-Powered-By": "ASP.NET",
    "Content-Length": "566496",
    "Content-Disposition": "attachment; filename=\"MetaData.json\"",
    "Content-Type": "application/octet-stream",
    "Expires": "-1"
  },
  "body": {
    "$content-type": "application/octet-stream",
    "$content": "ew0KICAibmFtZSI6ICI3OGI4ZTczMi1iOWE3LTQwMjYtYjc2My00MzdmMmY0YzFmNDkiLA0KICAiY29tcGF0aWJpbGl0eUxldmVsIjogMTUyMCwNCiAgImNyZWF0ZWRUaW1lc

 

 

 

 

I've tried to convert the DataModelSchema file to a JSON file but obtained the same result.

For last, I've converted the DataModelSchema file to a txt but the out put have some problems too...

 

Can anyone help me?

 

This is my flow: 

Joao_Macau_1-1613316837324.png

 

 

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @Joao_Macau :

Do you want to convert the content of the file into text?

If so ,I'm afraid that Parse JSON Action cannot convert the content of a file into text output. In fact the Inputs and Output of Parse JSON which is basically the same.

In general, the reason we use Parse JSON is because Flow doesn't know the format of the data we are receiving in our actions. Using Parse JSON can let Flow know the format of the data, and calls the specified value in Dynamic constant way directly  in the next operations.

I think this link will help you a lot:

A Thesis on the Parse JSON action in Microsoft Flow 

If you need to convert the content of a file into text, there are some actions that can achieve similar functions (but not all files can, depending on your file type).For example:

These Actions can get text from audio, PDF, and pictures

1.JPG

2.JPG

Best Regards,

Bof

Joao_Macau
Frequent Visitor

Thank very much for the reply!

 

And thank for the link! very useful information.

 

I've change teh "Get File Content" action to a "Get file Content Using Path" and then compose the output using the following formula:

"base64ToString(outputs('Get_file_content_using_path')?['body']?['$content'])"

 

"{\u0000\r\u0000\n\u0000 \u0000 \u0000\"\u0000n\u0000a\u0000m\u0000e\u0000\"\u0000:\u0000 \u0000\"\u00005\u0000d\u0000a\u0000a\u00003\u00007\u00003\u0000e\u0000-\u00004\u00002\u00001\u0000a\u0000-\u00004\u00007\u00000\u0000d\u0000-\u00009\u00009\u0000c\u00007\u0000-\u00005\u0000e\u00004\u00006\u00004\u00009\u0000e\u00004\u00006\u00009\u00002\u00004\u0000\"\u0000,\u0000\r\u0000\n\u0000 \u0000 " 

 

Is this related with encoding?

 

My original file is the DataModelShema file in a PowerBi.

 

When I converted it to a .json file it work but I'm trying to use the original file. Is it possible?

 

Cheers!

Hi @Joao_Macau :

Is this the code you need to parse?

"{\u0000\r\u0000\n\u0000 \u0000 \u0000\"\u0000n\u0000a\u0000m\u0000e\u0000\"\u0000:\u0000 \u0000\"\u00005\u0000d\u0000a\u0000a\u00003\u00007\u00003\u0000e\u0000-\u00004\u00002\u00001\u0000a\u0000-\u00004\u00007\u00000\u0000d\u0000-\u00009\u00009\u0000c\u00007\u0000-\u00005\u0000e\u00004\u00006\u00004\u00009\u0000e\u00004\u00006\u00009\u00002\u00004\u0000\"\u0000,\u0000\r\u0000\n\u0000 \u0000 " 

What should the original data look like?

I don't know the underlying logic of coding, but I'm afraid there is a high probability that your request will not be fulfilled.

Best Regards,

Bof

 

 

Joao_Macau
Frequent Visitor

hello!

 

This is part of the code! The file is very big and should look like this: 

 

"

{
"name": "5daa373e-421a-470d-99c7-5e4649e46924",
"compatibilityLevel": 1520,
"createdTimestamp": "2021-02-06T17:08:19.423333+00:00",
"lastUpdate": "2021-02-14T00:22:16.58+00:00",
"lastSchemaUpdate": "2021-02-06T17:13:30.023333+00:00",
"lastProcessed": "2021-02-11T12:38:28.696667+00:00",
"model": {
"culture": "pt-PT",
"dataAccessOptions": {
"legacyRedirects": true,
"returnErrorValuesAsNull": true
},
"defaultPowerBIDataSourceVersion": "powerBI_V3",
"sourceQueryCulture": "pt-PT",
"modifiedTime": "2021-02-06T17:13:30.176667",
"structureModifiedTime": "2021-02-08T15:19:44.506667",
"tables": [
{
"name": "DateTableTemplate_ca1b7db6-87d2-422f-b168-7a0e58495117",
"isHidden": true,
"isPrivate": true,
"modifiedTime": "2021-02-06T17:13:30.18",
"structureModifiedTime": "2021-02-06T17:13:30.18",
"columns": [
{
"type": "rowNumber",
"name": "RowNumber-2662979B-1795-4F74-8F37-6A1BA8059B61",
"dataType": "int64",
"isHidden": true,
"isUnique": true,
"isKey": true,
"isNullable": false,
"modifiedTime": "2021-02-06T17:13:30.186667",
"structureModifiedTime": "2021-02-06T17:13:30.18",
"refreshedTime": "1699-12-31T00:00:00",
"attributeHierarchy": {
"state": "ready",
"modifiedTime": "2021-02-06T17:13:33.046667",
"refreshedTime": "2021-02-06T17:13:33.046667"
},
"annotations": [
{
"name": "DataTypeAtRefresh",
"value": "Int64#####not a type",
"modifiedTime": "2021-02-09T16:22:42.41"
}
]
},
{
"type": "calculatedTableColumn",
"name": "Date",
"dataType": "dateTime",
"isNameInferred": true,
"isDataTypeInferred": true,
"isHidden": true,
"sourceColumn": "[Date]",
"dataCategory": "PaddedDateTableDates",
"summarizeBy": "none",
"modifiedTime": "2021-02-09T16:22:42.41",
"structureModifiedTime": "2021-02-06T17:13:30.183333",
"refreshedTime": "1699-12-31T00:00:00",
"attributeHierarchy": {
"state": "ready",
"modifiedTime": "2021-02-06T17:13:33.05",
"refreshedTime": "2021-02-06T17:13:33.05"
},
"annotations": [
{
"name": "SummarizationSetBy",
"value": "User",
"modifiedTime": "2021-02-06T17:13:30.186667"
},"

 

I guess this "transformation" is related with the "Get file content using path" when i used the "Get file content" it gave a different output, with a Content-Type: application/octet-stream.

 

But anyway thank very much for the reply! 🙂

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (36,541)