I'm trying to use jp#gc - JSON/YAML Path Assertion, when my Response Body is:
[
{
"label": "Alabama",
"value": "AL"
},
{
"label": "Alaska",
"value": "AK"
},
{
"label": "American Samoa",
"value": "AS"
},
{
"label": "Arizona",
"value": "AZ"
},
{
"label": "Arkansas",
"value": "AR"
},
{
"label": "California",
"value": "CA"
},
{
"label": "Colorado",
"value": "CO"
},
{
"label": "Connecticut",
"value": "CT"
},
{
"label": "Delaware",
"value": "DE"
},
{
"label": "District Of Columbia",
"value": "DC"
},
{
"label": "Federated States Of Micronesia",
"value": "FM"
},
{
"label": "Florida",
"value": "FL"
},
{
"label": "Georgia",
"value": "GA"
},
{
"label": "Guam",
"value": "GU"
},
{
"label": "Hawaii",
"value": "HI"
},
{
"label": "Idaho",
"value": "ID"
},
{
"label": "Illinois",
"value": "IL"
},
{
"label": "Indiana",
"value": "IN"
},
{
"label": "Iowa",
"value": "IA"
},
{
"label": "Kansas",
"value": "KS"
},
{
"label": "Kentucky",
"value": "KY"
},
{
"label": "Louisiana",
"value": "LA"
},
{
"label": "Maine",
"value": "ME"
},
{
"label": "Marshall Islands",
"value": "MH"
},
{
"label": "Maryland",
"value": "MD"
},
{
"label": "Massachusetts",
"value": "MA"
},
{
"label": "Michigan",
"value": "MI"
},
{
"label": "Minnesota",
"value": "MN"
},
{
"label": "Mississippi",
"value": "MS"
},
{
"label": "Missouri",
"value": "MO"
},
{
"label": "Montana",
"value": "MT"
},
{
"label": "Nebraska",
"value": "NE"
},
{
"label": "Nevada",
"value": "NV"
},
{
"label": "New Hampshire",
"value": "NH"
},
{
"label": "New Jersey",
"value": "NJ"
},
{
"label": "New Mexico",
"value": "NM"
},
{
"label": "New York",
"value": "NY"
},
{
"label": "North Carolina",
"value": "NC"
},
{
"label": "North Dakota",
"value": "ND"
},
{
"label": "Northern Mariana Islands",
"value": "MP"
},
{
"label": "Ohio",
"value": "OH"
},
{
"label": "Oklahoma",
"value": "OK"
},
{
"label": "Oregon",
"value": "OR"
},
{
"label": "Palau",
"value": "PW"
},
{
"label": "Pennsylvania",
"value": "PA"
},
{
"label": "Puerto Rico",
"value": "PR"
},
{
"label": "Rhode Island",
"value": "RI"
},
{
"label": "South Carolina",
"value": "SC"
},
{
"label": "South Dakota",
"value": "SD"
},
{
"label": "Tennessee",
"value": "TN"
},
{
"label": "Texas",
"value": "TX"
},
{
"label": "Utah",
"value": "UT"
},
{
"label": "Vermont",
"value": "VT"
},
{
"label": "Virgin Islands",
"value": "VI"
},
{
"label": "Virginia",
"value": "VA"
},
{
"label": "Washington",
"value": "WA"
},
{
"label": "West Virginia",
"value": "WV"
},
{
"label": "Wisconsin",
"value": "WI"
},
{
"label": "Wyoming",
"value": "WY"
}
]
Here is how is use the JSON/YAML Path Assertion:
but I'm getting Assertion failure:
The following setup should work for you:
More information:
JsonPath - Getting Started
Perl 5 Regex Cheat sheet
The New JSON/YAML Plugin - Using YAML in JMeter
Use JSON Assertion ( jp#gc - JSON/YAML is deprecated)
JSON start with array so use JSON Path
$.[0].label
You can also uncheck Match as regular expression
I've been trying to create a basic json for our testes to throw up a machine a and when required. I got most of it done however I am getting the following errors:
Line 158 Unexpected character sequence in member name
Line 167 A member with the name 'Properties' already exists
I understand 67 needs to be unique, but everytime I change and remove the { it creates more errors.
And unexpected character is the { on line 157, which I'm guessing should be either a string, maybe?
My template is below.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"virtualMachineName": {
"type": "string"
},
"offer": {
"type": "string",
"defaultvalue": "Windows",
"allowedValues": [
"windows",
"centos",
"RHEL"
]
},
"sku": {
"type": "string",
"defaultvalue": "2012-r2-datacenter",
"allowedValues": [
"2012-R2-Datacenter",
"2012-R2",
"68",
"72",
"73",
"74"
]
},
"virtualMachineSize": {
"type": "string",
"defaultvalue": "standard_A0",
"allowedValues": [
"Standard_A0",
"Standard_A1",
"standard_A2"
]
},
"adminUsername": {
"type": "string"
},
"ipaddress": {
"type": "string"
},
"virtualNetworkName": {
"type": "string"
},
"networkInterfaceName": {
"type": "string"
},
"networkSecurityGroupName": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"storageAccountName": {
"type": "string"
},
"diagnosticsStorageAccountName": {
"type": "string"
},
"diagnosticsStorageAccountId": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"ContainerName": {
"type": "string"
},
"autoShutdownStatus": {
"type": "string"
},
"autoShutdownTime": {
"type": "string"
},
"autoShutdownTimeZone": {
"type": "string"
},
"autoShutdownNotificationStatus": {
"type": "string"
}
},
"variables": {
"vnetId": "[resourceId('avset','Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]",
"stdvhdcontainername": "[concat(parameters('Containername'))]",
"vmosidiskname": "[concat(parameters('virtualMachineName'),'-osdisk')]"
},
"resources": [
{
"name": "[parameters('virtualMachineName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]"
],
"properties": {
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat (parameters('diagnosticsStorageAccountName')), ['blob']]"
}
},
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachineName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"offer": "[concat(parameters('offer'))]",
"sku": "[concat(parameters('offer'))]",
"version": "latest"
}
},
"osDisk": {
"vhd": {
"name": "[variables('vmosidiskname')]",
"uri": "[concat('http://', parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdvhdcontainername'),'/', variables('vmosidiskname'), '.vhd')]"
},
"name": "[parameters('virtualMachineName')]"
},
"name": "[concat('shutdown-computevm-', parameters('virtualMachineName'))]",
"type": "Microsoft.DevTestLab/schedules",
"apiVersion": "2017-04-26-preview",
"location": "[parameters('location')]",
"properties": {
"status": "[parameters('autoShutdownStatus')]",
"taskType": "ComputeVmShutdownTask",
"dailyRecurrence": {
"time": "[parameters('autoShutdownTime')]"
},
"timeZoneId": "[parameters('autoShutdownTimeZone')]",
"targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]",
"notificationSettings": {
"status": "[parameters('autoShutdownNotificationStatus')]",
"timeInMinutes": "30"
},
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
]
},
{
"name": "[parameters('networkInterfaceName')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[parameters('location')]"
},
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateipaddress": "[concat(parameters('ipaddress'))]",
"privateIPAllocationMethod": "static"
}
}
]
}
},
"outputs": [
{
"adminUsername": {
"type": "string",
"value": "[parameters('adminUsername')]"
}
}
]
}
]
}
Any pointers would be greatly appreciated.. thanks for your help :)
Params are below:)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "westeurope"
},
"virtualMachineName": {
"value": "cent-os-vm2"
},
"virtualMachineSize": {
"value": "Standard_A0"
},
"adminUsername": {
"value": "localadmin"
},
"virtualNetworkName": {
"value": "avset-vnet"
},
"networkInterfaceName": {
"value": "cent-os-vm01652"
},
"networkSecurityGroupName": {
"value": "cent-os-vm01-nsg"
},
"storageAccountName": {
"value": "avsetdisks419"
},
"diagnosticsStorageAccountName": {
"value": "avsetdiag112"
},
"diagnosticsStorageAccountId": {
"value": "avsetdiag117"
},
"subnetName": {
"value": "default"
},
"autoShutdownStatus": {
"value": "Enabled"
},
"autoShutdownTime": {
"value": "19:00"
},
"autoShutdownTimeZone": {
"value": "UTC"
},
"autoShutdownNotificationStatus": {
"value": "Disabled"
},
"ContainerName": {
"value": "vhd"
},
"offer": {
"value": "windows"
},
"sku": {
"value": "2012-R2-Datacenter"
},
"ipaddress": {
"value": "10.0.1.9"
}
}
}
There are many mistakes in your template. The following template should work.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"virtualMachineName": {
"type": "string"
},
"offer": {
"type": "string",
"defaultvalue": "windows",
"allowedValues": [
"windows",
"centos",
"RHEL"
]
},
"sku": {
"type": "string",
"defaultvalue": "2012-R2-Datacenter",
"allowedValues": [
"2012-R2-Datacenter",
"2012-R2",
"68",
"72",
"73",
"74"
]
},
"virtualMachineSize": {
"type": "string",
"defaultvalue": "Standard_A0",
"allowedValues": [
"Standard_A0",
"Standard_A1",
"standard_A2"
]
},
"adminUsername": {
"type": "string"
},
"ipaddress": {
"type": "string"
},
"virtualNetworkName": {
"type": "string"
},
"networkInterfaceName": {
"type": "string"
},
"networkSecurityGroupName": {
"type": "string"
},
"adminPassword": {
"type": "securestring"
},
"storageAccountName": {
"type": "string"
},
"diagnosticsStorageAccountName": {
"type": "string"
},
"diagnosticsStorageAccountId": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"ContainerName": {
"type": "string"
},
"autoShutdownStatus": {
"type": "string"
},
"autoShutdownTime": {
"type": "string"
},
"autoShutdownTimeZone": {
"type": "string"
},
"autoShutdownNotificationStatus": {
"type": "string"
}
},
"variables": {
"vnetId": "[resourceId('avset','Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]",
"stdvhdcontainername": "[concat(parameters('Containername'))]",
"vmosidiskname": "[concat(parameters('virtualMachineName'),'-osdisk')]"
},
"resources": [
{
"name": "[parameters('virtualMachineName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]"
],
"properties": {
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat (parameters('diagnosticsStorageAccountName')), ['blob']]"
}
},
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachineName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"offer": "[concat(parameters('offer'))]",
"sku": "[concat(parameters('offer'))]",
"version": "latest"
}
},
"osDisk": {
"vhd": {
"name": "[variables('vmosidiskname')]",
"uri": "[concat('http://', parameters('storageAccountName'), '.blob.core.windows.net/', variables('stdvhdcontainername'),'/', variables('vmosidiskname'), '.vhd')]"
},
"name": "[parameters('virtualMachineName')]"
}
}
},
{
"name": "[concat('shutdown-computevm-', parameters('virtualMachineName'))]",
"type": "Microsoft.DevTestLab/schedules",
"apiVersion": "2017-04-26-preview",
"location": "[parameters('location')]",
"properties": {
"status": "[parameters('autoShutdownStatus')]",
"taskType": "ComputeVmShutdownTask",
"dailyRecurrence": {
"time": "[parameters('autoShutdownTime')]"
},
"timeZoneId": "[parameters('autoShutdownTimeZone')]",
"targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]",
"notificationSettings": {
"status": "[parameters('autoShutdownNotificationStatus')]",
"timeInMinutes": "30"
},
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
]
}
},
{
"name": "[parameters('networkInterfaceName')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateipaddress": "[concat(parameters('ipaddress'))]",
"privateIPAllocationMethod": "static"
}
}
]
}
}
],
"outputs": {
"adminUsername": {
"type": "string",
"value": "[parameters('adminUsername')]"
}
}
}
In line 162, it lost a ,. Resource Microsoft.Compute/virtualMachines,Microsoft.DevTestLab/schedules,Microsoft.Network/networkInterfaces are in parallel. But in your template, Microsoft.Compute/virtualMachines contains others, so you get error log with the name 'Properties' already exists.
Note: You also need check your default value. Please note that case sensitive.
Update:
Ipconfigurations is wrong, it should like below:
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
Update 2:
The template.json and parameters.json works for me. Maybe you could modify your template according to this example.
I am working with a reports API from an Application which converts an HTML table into JSON using a method very similar to that shown in posts in Stack Overflow (example: HTML Table to JSON).
The JSON has an array of columns (for the NAMES of VALUES), then there is an array of rows which contain cells (for the VALUES).
I want to map this report to a canonical data model but it is horrible to work with. What I want to do is run some sort of script on the JSON which reverse what the original script put in place and turns it into an array that contains individual records, much like the rows of a CSV file.
Here's an example of a report I am referring to - horrible isn't it :)
My Question
Is there a way of turning this format of JSON (where it has an array for column names, an array for sections and inside an array of rows which relate to the column names), into a table of some sort?
{
"Header": {
"Time": "2016-03-30T16:10:19-07:00",
"ReportName": "GeneralLedger",
"ReportBasis": "Accrual",
"StartPeriod": "2016-01-01",
"EndPeriod": "2016-03-31",
"Currency": "GBP",
"Option": [
{
"Name": "NoReportData",
"Value": "false"
}
]
},
"Columns": {
"Column": [
{
"ColTitle": "Date",
"ColType": "tx_date"
},
{
"ColTitle": "Transaction Type",
"ColType": "txn_type"
},
{
"ColTitle": "No.",
"ColType": "doc_num"
},
{
"ColTitle": "Name",
"ColType": "name"
},
{
"ColTitle": "Memo/Description",
"ColType": "memo"
},
{
"ColTitle": "Split",
"ColType": "split_acc"
},
{
"ColTitle": "Amount",
"ColType": "subt_nat_amount"
},
{
"ColTitle": "Balance",
"ColType": "rbal_nat_amount"
}
]
},
"Rows": {
"Row": [
{
"Header": {
"ColData": [
{
"value": "Current",
"id": "144"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Bill Payment (Cheque)",
"id": "181"
},
{
"value": "1"
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": "104478"
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "-600.0"
},
{
"value": "-600.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill Payment (Cheque)",
"id": "184"
},
{
"value": "2"
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": "104478"
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "-120.0"
},
{
"value": "-720.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Deposit",
"id": "180"
},
{
"value": ""
},
{
"value": "",
"id": ""
},
{
"value": "Opening Balance"
},
{
"value": "Opening Balance Equity",
"id": "137"
},
{
"value": "2400.0"
},
{
"value": "1680.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-23"
},
{
"value": "Payment",
"id": "186"
},
{
"value": "345678"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": ""
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "216.0"
},
{
"value": "1896.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Current"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "1896.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Debtors",
"id": "140"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": ""
},
{
"value": "-Split-",
"id": ""
},
{
"value": "216.0"
},
{
"value": "216.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": ""
},
{
"value": "-Split-",
"id": ""
},
{
"value": "108.0"
},
{
"value": "324.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-23"
},
{
"value": "Payment",
"id": "186"
},
{
"value": "345678"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": ""
},
{
"value": "Current",
"id": "144"
},
{
"value": "-216.0"
},
{
"value": "108.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Debtors"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "108.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Stock Asset",
"id": "136"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-01"
},
{
"value": "Stock Starting Value",
"id": "173"
},
{
"value": "START"
},
{
"value": "",
"id": ""
},
{
"value": "Round Neck T Shirt - Opening stock and value"
},
{
"value": "Opening Balance Equity",
"id": "137"
},
{
"value": "0.0"
},
{
"value": "0.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "-12.0"
},
{
"value": "-12.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "-24.0"
},
{
"value": "-36.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Stock Qty Adjust",
"id": "177"
},
{
"value": "2"
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": "0.0"
},
{
"value": "-36.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Stock Qty Adjust",
"id": "182"
},
{
"value": "3"
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": "-36.0"
},
{
"value": "-72.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Stock Qty Adjust",
"id": "182"
},
{
"value": "3"
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": "-564.0"
},
{
"value": "-636.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Stock Qty Adjust",
"id": "177"
},
{
"value": "2"
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": "600.0"
},
{
"value": "-36.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Stock Qty Adjust",
"id": "182"
},
{
"value": "3"
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": "0.0"
},
{
"value": "-36.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "178"
},
{
"value": ""
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "600.0"
},
{
"value": "564.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Stock Asset"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "564.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Creditors",
"id": "138"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Bill Payment (Cheque)",
"id": "181"
},
{
"value": "1"
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": ""
},
{
"value": "Current",
"id": "144"
},
{
"value": "-600.0"
},
{
"value": "-600.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill Payment (Cheque)",
"id": "184"
},
{
"value": "2"
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": ""
},
{
"value": "Current",
"id": "144"
},
{
"value": "-120.0"
},
{
"value": "-720.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "185"
},
{
"value": ""
},
{
"value": "British Power",
"id": "72"
},
{
"value": ""
},
{
"value": "Utilities",
"id": "129"
},
{
"value": "192.15"
},
{
"value": "-527.85"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "183"
},
{
"value": ""
},
{
"value": "Printing Ink Supplies",
"id": "71"
},
{
"value": ""
},
{
"value": "-Split-",
"id": ""
},
{
"value": "1920.0"
},
{
"value": "1392.15"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "178"
},
{
"value": ""
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": ""
},
{
"value": "Stock Asset",
"id": "136"
},
{
"value": "720.0"
},
{
"value": "2112.15"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Creditors"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "2112.15"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "VAT Control",
"id": "142"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": ""
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "36.0"
},
{
"value": "36.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": ""
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "18.0"
},
{
"value": "54.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "185"
},
{
"value": ""
},
{
"value": "British Power",
"id": "72"
},
{
"value": ""
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "-9.15"
},
{
"value": "44.85"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "183"
},
{
"value": ""
},
{
"value": "Printing Ink Supplies",
"id": "71"
},
{
"value": ""
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "-320.0"
},
{
"value": "-275.15"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Bill",
"id": "178"
},
{
"value": ""
},
{
"value": "Teddy's T Shirt Supplier",
"id": "70"
},
{
"value": ""
},
{
"value": "Creditors",
"id": "138"
},
{
"value": "-120.0"
},
{
"value": "-395.15"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for VAT Control"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "-395.15"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Opening Balance Equity",
"id": "137"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-01"
},
{
"value": "Stock Starting Value",
"id": "173"
},
{
"value": "START"
},
{
"value": "",
"id": ""
},
{
"value": "Round Neck T Shirt - Opening stock and value"
},
{
"value": "Stock Asset",
"id": "136"
},
{
"value": "0.0"
},
{
"value": "0.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-17"
},
{
"value": "Deposit",
"id": "180"
},
{
"value": ""
},
{
"value": "",
"id": ""
},
{
"value": ""
},
{
"value": "Current",
"id": "144"
},
{
"value": "2400.0"
},
{
"value": "2400.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Opening Balance Equity"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "2400.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Sales of Product Income",
"id": "133"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "60.0"
},
{
"value": "60.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "120.0"
},
{
"value": "180.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Sales of Product Income"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "180.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Services",
"id": "131"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": "Print on Pocket"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "60.0"
},
{
"value": "60.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": "Print on Pocket"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "30.0"
},
{
"value": "90.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Services"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "90.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Cost of sales",
"id": "134"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
},
"Rows": {
"Row": [
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "176"
},
{
"value": "1014"
},
{
"value": "Maxamillion Enterprises",
"id": "68"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "24.0"
},
{
"value": "24.0"
}
],
"type": "Data"
},
{
"ColData": [
{
"value": "2016-03-16"
},
{
"value": "Invoice",
"id": "179"
},
{
"value": "1015"
},
{
"value": "Hope Reality Limited",
"id": "69"
},
{
"value": "Round Neck T Shirt"
},
{
"value": "Debtors",
"id": "140"
},
{
"value": "12.0"
},
{
"value": "36.0"
}
],
"type": "Data"
}
]
},
"Summary": {
"ColData": [
{
"value": "Total for Cost of sales"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": "36.0"
},
{
"value": ""
}
]
},
"type": "Section"
},
{
"Header": {
"ColData": [
{
"value": "Stock Shrinkage",
"id": "141"
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
},
{
"value": ""
}
]
}
etc. I had to cut this JSON short, limited to 30000 characters.
What have you tried so far? This seems pretty straightforward. To get the rows into an array format you would do something like the following:
var data = {
"Header": {
"Time": "2016-03-30T16:10:19-07:00",
"ReportName": "GeneralLedger",
"ReportBasis": "Accrual",
"StartPeriod": "2016-01-01",
"EndPeriod": "2016-03-31",
"Currency": "GBP",
"Option": [{
"Name": "NoReportData",
"Value": "false"
}]
},
"Columns": {
"Column": [{
"ColTitle": "Date",
"ColType": "tx_date"
}, {
"ColTitle": "Transaction Type",
"ColType": "txn_type"
}, {
"ColTitle": "No.",
"ColType": "doc_num"
}, {
"ColTitle": "Name",
"ColType": "name"
}, {
"ColTitle": "Memo/Description",
"ColType": "memo"
}, {
"ColTitle": "Split",
"ColType": "split_acc"
}, {
"ColTitle": "Amount",
"ColType": "subt_nat_amount"
}, {
"ColTitle": "Balance",
"ColType": "rbal_nat_amount"
}]
},
"Rows": {
"Row": [{
"Header": {
"ColData": [{
"value": "Current",
"id": "144"
}, {
"value": ""
}, {
"value": ""
}, {
"value": ""
}, {
"value": ""
}, {
"value": ""
}, {
"value": ""
}, {
"value": ""
}]
},
"Rows": {
"Row": [{
"ColData": [{
"value": "2016-03-16"
}, {
"value": "Bill Payment (Cheque)",
"id": "181"
}, {
"value": "1"
}, {
"value": "Teddy's T Shirt Supplier",
"id": "70"
}, {
"value": "104478"
}, {
"value": "Creditors",
"id": "138"
}, {
"value": "-600.0"
}, {
"value": "-600.0"
}],
"type": "Data"
}, {
"ColData": [{
"value": "2016-03-17"
}, {
"value": "Bill Payment (Cheque)",
"id": "184"
}, {
"value": "2"
}, {
"value": "Teddy's T Shirt Supplier",
"id": "70"
}, {
"value": "104478"
}, {
"value": "Creditors",
"id": "138"
}, {
"value": "-120.0"
}, {
"value": "-720.0"
}],
"type": "Data"
}, {
"ColData": [{
"value": "2016-03-17"
}, {
"value": "Deposit",
"id": "180"
}, {
"value": ""
}, {
"value": "",
"id": ""
}, {
"value": "Opening Balance"
}, {
"value": "Opening Balance Equity",
"id": "137"
}, {
"value": "2400.0"
}, {
"value": "1680.0"
}],
"type": "Data"
}, {
"ColData": [{
"value": "2016-03-23"
}, {
"value": "Payment",
"id": "186"
}, {
"value": "345678"
}, {
"value": "Maxamillion Enterprises",
"id": "68"
}, {
"value": ""
}, {
"value": "Debtors",
"id": "140"
}, {
"value": "216.0"
}, {
"value": "1896.0"
}],
"type": "Data"
}]
}
}]
}
};
function parse(data) {
var rows = [],
row, curRow, rowSegment;
for (var i = 0; i < data.Rows.Row.length; ++i) {
rowSegment = data.Rows.Row[i].Rows.Row;
for (var j = 0; j < rowSegment.length; ++j) {
row = [];
curRow = rowSegment[j].ColData;
for (var x = 0; x < curRow.length; ++x) {
row.push(curRow[x].value);
}
rows.push(row);
}
}
return rows;
}
var parsed = parse(data);
var rowEl, outEl = document.getElementById('html-out'),
val;
for (var i = 0; i < parsed.length; ++i) {
rowEl = document.createElement("div");
rowEl.setAttribute("class", "row");
rowEl.appendChild(document.createTextNode(parsed[i].join(', ')));
outEl.appendChild(rowEl);
}
<div id="html-out"></div>
Also, you would probably want to add the columns as the first row but this looks like it would get you the CSV-type data you are going for.