cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SPOFLOW
Level: Powered On

Convert JSON string to JSON array

Ive followed this same template 5 times already without any issue. 

proceduretocsv.PNG

Test is successfull until It gets to csv. 

I get the following error:

failure.PNG

The Table1 input  from Parse JSON is not null!

 

My parse json output shows:

{"body":{"Table1":[{"BatchCode":"CL20","EmployeeCode":"28907","Department":6160,"PayType":"R","regularhours":9.0,"Job":"","Phase":"","CostType":"","Date":"03/18/19","MessageLine":"","PayRateLevel":"","WageCode":"","UnionCode":"","WorkersComp":"","StateTaxCode":"","CountyTaxCode":"","LocalTaxCode":"","EquipmentCode":"0242","Equipmenthours":"","Quantity":"","CompanyCode":"","PayRate":"","EquipmentCostCategory":"6050","CrewNumber":"","CostCenter":"","WorkOrder":"","SiteEquipment":"","Sitecomponent":"","Contract":"","EquipmentWorkOrder":"161121","BillingCode":"","BillingRate":""},{"BatchCode":"CL20","EmployeeCode":"28907","Department":6160,"PayType":"R","regularhours":1.0,"Job":"","Phase":"","CostType":"","Date":"03/18/19","MessageLine":"","PayRateLevel":"","WageCode":"","UnionCode":"","WorkersComp":"","StateTaxCode":"","CountyTaxCode":"","LocalTaxCode":"","EquipmentCode":"8040","Equipmenthours":"","Quantity":"","CompanyCode":"","PayRate":"","EquipmentCostCategory":"4250","CrewNumber":"","CostCenter":"","WorkOrder":"","SiteEquipment":"","Sitecomponent":"","Contract":"","EquipmentWorkOrder":"160453","BillingCode":"","BillingRate":""},{"BatchCode":"CL20","EmployeeCode":"28907","Department":6160,"PayType":"R","regularhours":2.0,"Job":"","Phase":"","CostType":"","Date":"03/18/19","MessageLine":"","PayRateLevel":"","WageCode":"","UnionCode":"","WorkersComp":"","StateTaxCode":"","CountyTaxCode":"","LocalTaxCode":"","EquipmentCode":"0749","Equipmenthours":"","Quantity":"","CompanyCode":"","PayRate":"","EquipmentCostCategory":"3650","CrewNumber":"","CostCenter":"","WorkOrder":"","SiteEquipment":"","Sitecomponent":"","Contract":"","EquipmentWorkOrder":"161025","BillingCode":"","BillingRate":""},{"BatchCode":"CL20","EmployeeCode":"28907","Department":6160,"PayType":"R","regularhours":7.0,"Job":"","Phase":"","CostType":"","Date":"03/19/19","MessageLine":"","PayRateLevel":"","WageCode":"","UnionCode":"","WorkersComp":"","StateTaxCode":"","CountyTaxCode":"","LocalTaxCode":"","EquipmentCode":"0749","Equipmenthours":"","Quantity":"","CompanyCode":"","PayRate":"","EquipmentCostCategory":"3650","CrewNumber":"","CostCenter":"","WorkOrder":"","SiteEquipment":"","Sitecomponent":"","Contract":"","EquipmentWorkOrder":"161025","BillingCode":"","BillingRate":""},{"BatchCode":"CL20","EmployeeCode":"28907","Department":6160,"PayType":"R","regularhours":1.0,"Job":"","Phase":"","CostType":"","Date":"03  .

Why am I getting this "Null" error in the Create CSV ?

1 ACCEPTED SOLUTION

Accepted Solutions
v-zhos-msft
Level 10

Re: Convert JSON string to JSON array

Hi @SPOFLOW ,

I sugget you add a 'Compose' action to check the output of the Table1, make sure the output is an array.

I have made a test with the json you have provided.

{  
   "body":{  
      "Table1":[  
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":9.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0242",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"6050",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161121",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":1.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"8040",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"4250",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"160453",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":2.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0749",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"3650",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161025",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":7.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/19/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0749",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"3650",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161025",
            "BillingCode":"",
            "BillingRate":""
         }
      ]
   }
}
In the 'Compse' action is the Json you have provided.
Capture13.PNGCapture14.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhos-msft
Level 10

Re: Convert JSON string to JSON array

Hi @SPOFLOW ,

I sugget you add a 'Compose' action to check the output of the Table1, make sure the output is an array.

I have made a test with the json you have provided.

{  
   "body":{  
      "Table1":[  
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":9.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0242",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"6050",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161121",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":1.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"8040",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"4250",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"160453",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":2.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/18/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0749",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"3650",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161025",
            "BillingCode":"",
            "BillingRate":""
         },
         {  
            "BatchCode":"CL20",
            "EmployeeCode":"28907",
            "Department":6160,
            "PayType":"R",
            "regularhours":7.0,
            "Job":"",
            "Phase":"",
            "CostType":"",
            "Date":"03/19/19",
            "MessageLine":"",
            "PayRateLevel":"",
            "WageCode":"",
            "UnionCode":"",
            "WorkersComp":"",
            "StateTaxCode":"",
            "CountyTaxCode":"",
            "LocalTaxCode":"",
            "EquipmentCode":"0749",
            "Equipmenthours":"",
            "Quantity":"",
            "CompanyCode":"",
            "PayRate":"",
            "EquipmentCostCategory":"3650",
            "CrewNumber":"",
            "CostCenter":"",
            "WorkOrder":"",
            "SiteEquipment":"",
            "Sitecomponent":"",
            "Contract":"",
            "EquipmentWorkOrder":"161025",
            "BillingCode":"",
            "BillingRate":""
         }
      ]
   }
}
In the 'Compse' action is the Json you have provided.
Capture13.PNGCapture14.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

SPOFLOW
Level: Powered On

Re: Convert JSON string to JSON array

I did as you suggested and added a compose.  my options from the parse json were numerous. 

123.PNG

I thought choosing table1 would give me the results i wanted. However, I get no  results from it or "body". "Body" ,on the other hand, gives me this:

456.PNG

of course it fails when i try to put it to csv.  I'm at a loss.  not sure what to do at this point.

 

SPOFLOW
Level: Powered On

Re: Convert JSON string to JSON array

I figured it out but had to run it thorugh twice!

789.PNG

Thank you for your help.

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,622)