We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using C:\RubyLearnToProgram>json2csv convert sample.json results in following error:
Converting sample.json error: undefined method `keys' for "PREPARED":String
The sample.json: { "preparationState": "PREPARED", "consumerUsageStorageInstruction": { "de": "gebruik", "fr": "gebruik", "en": "gebruik" }, "npc": "1234", "drainedWeight": "320.0GR", "isBaseUnit": "true", "packagingMarkedExpirationDateType": "BEST_BEFORE_DATE", "numberOfServingsPerPackage": "100", "functionalName": "Babbelaars", "preparationInstructions": { "de": "koken", "fr": "koken", "en": "koken" }, "brandName": "Test lets try this one", "manufacturerGln": "5060263871002", "packagingRefuseObligationName": "ARA", "gln": "5060263871002", "height": "129.0MM", "percentageOfAlcoholByVolume": "0.0", "dailyValueIntakeReference": "10 a day keeps the doctor away", "allergenStatement": { "de": "Enthalt: Milch (Laktose)", "fr": "Contient: lait de vache (lactose)", "en": "Bevat: koemelk (lactose)" }, "isPackagingMarkedReturnable": "false", "netContent": "325.0GR", "regulatedProductName": "Babbelaars", "itemThumbnail": "/a/16257a91e7c42b64fdc7ad91292dce85/babbelaars.png", "packages": [ { "height": "100.0CM", "containedGtin": "90000000000003", "gtin": "91000000000002", "width": "50.0CM", "netContent": "100.0EA", "packageUnitIndicator": "CASE", "depth": "60.0CM", "containedAmount": "10", "grossWeight": "109.0KG" } ], "isVariableUnit": "false", "taxRate": "STANDARD", "width": "67.0MM", "targetMarket": "528", "gpc": "10000005", "nameOfInformationProvider": "LANSA", "depth": "67.0MM", "grossWeight": "350.0GR", "nutrients": [{ "percentageOfDailyValueIntake":"0.1","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"1.0","quantityContainedHouseHoldServingSize":"10.0","quantityContainedUnit":"GR","nutrientTypeCode":"CHOAVL-" },{ "percentageOfDailyValueIntake":"0.2","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"2.0","quantityContainedHouseHoldServingSize":"20.0","quantityContainedUnit":"E14","nutrientTypeCode":"ENER-" },{ "percentageOfDailyValueIntake":"0.3","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"3.0","quantityContainedHouseHoldServingSize":"30.0","quantityContainedUnit":"GR","nutrientTypeCode":"FASAT" },{ "percentageOfDailyValueIntake":"0.4","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"4.0","quantityContainedHouseHoldServingSize":"40.0","quantityContainedUnit":"KJO","nutrientTypeCode":"ENER-" },{ "percentageOfDailyValueIntake":"0.5","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"5.0","quantityContainedHouseHoldServingSize":"50.0","quantityContainedUnit":"GR","nutrientTypeCode":"FIBTG" },{ "percentageOfDailyValueIntake":"0.6","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"6.0","quantityContainedHouseHoldServingSize":"60.0","quantityContainedUnit":"GR","nutrientTypeCode":"PRO-" },{ "percentageOfDailyValueIntake":"0.7","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"7.0","quantityContainedHouseHoldServingSize":"70.0","quantityContainedUnit":"GR","nutrientTypeCode":"FAT" },{ "percentageOfDailyValueIntake":"0.8","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"8.0","quantityContainedHouseHoldServingSize":"80.0","quantityContainedUnit":"GR","nutrientTypeCode":"SUGAR-" },{ "percentageOfDailyValueIntake":"0.9","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"9.0","quantityContainedHouseHoldServingSize":"90.0","quantityContainedUnit":"GR","nutrientTypeCode":"SALTEQ" }], "ingredientStatement": { "de": "Zucker, Glukosesirup, Zuckersirup, Butter (3%), Salz.", "fr": "sucre, sirop de glucose, sirop de sucre, beurre (3%), sel.", "en": "sugar, glucose syrup, sugar syrup, butter (3%), salt." }, "isItemReturnable": "false", "shortDescription": { "en": "Babbelaars" }, "allergens": [ { "allergenTypeCode": "BB", "levelOfContainment": "CONTAINS" } ], "contactName": "LANSAEU1169", "startAvailabilityDate": "2015-05-19", "myattribute": "MyPostedEach", "minimumLifespanFromTimeOfArrival": "8", "householdServingSize": "household serving size", "isDispatchUnit": "false", "isBasePriceDeclarationRelevant": "false", "allergenSpecificationAgency": "EU", "isOrderableUnit": "false", "allergenSpecificationName": "1169/2011", "additives": [ { "additiveName": "additive sample name", "levelOfContainment": "CONTAINS" } ], "minimumLifespanFromTimeOfProduction": "10", "baseUnitIndicator": "BASE_UNIT_OR_EACH", "effectiveDate": "2015-05-19", "servingSize": "GR", "countryOfOrigin": "528", "preparationType": "PRESSURE_COOKING", "supplierItemNumber": "324324234", "gtin": "90000000000003", "pallets": [ { "palletTypeCode": "37", "height": "10.0MR", "optionalGtin": "92000000000001", "containedGtin": "91000000000002", "palletTermsAndConditions": "3", "width": "250.0CM", "quantityOfLayersPerPallet": "5", "palletUnitIndicator": "PALLET", "depth": "120.0CM", "containedAmount": "50", "grossWeight": "1200.0KG", "logisticsUnitStackingFactor": "10" } ], "barCodeType": "EAN_UCC_13_SYMBOL", "nameOfManufacturer": "LANSA", "compulsoryAdditivesLabelInformation": { "de": "comp add label", "fr": "comp add label", "en": "comp add label" }, "isInvoiceUnit": "false", "isConsumerUnit": "true", "packagingTypeCode": "CAN", "communicationAddress": "Leliehof 26, 4841 ML PRINSENBEEK", "itemImage": "/a/d59455129b92fb21dd00a97746a81439/babbelaars.png", "isPackagingExemptFromRefuseObligation": "NOT_APPLICABLE" }
Could you help me with this, I'm trying to get all keys and nested keys to create a dynamic conversion of values. Thanks in advance, Greetings Danny
The text was updated successfully, but these errors were encountered:
No branches or pull requests
using C:\RubyLearnToProgram>json2csv convert sample.json
results in following error:
Converting sample.json
error: undefined method `keys' for "PREPARED":String
The sample.json:
{
"preparationState": "PREPARED",
"consumerUsageStorageInstruction": {
"de": "gebruik",
"fr": "gebruik",
"en": "gebruik"
},
"npc": "1234",
"drainedWeight": "320.0GR",
"isBaseUnit": "true",
"packagingMarkedExpirationDateType": "BEST_BEFORE_DATE",
"numberOfServingsPerPackage": "100",
"functionalName": "Babbelaars",
"preparationInstructions": {
"de": "koken",
"fr": "koken",
"en": "koken"
},
"brandName": "Test lets try this one",
"manufacturerGln": "5060263871002",
"packagingRefuseObligationName": "ARA",
"gln": "5060263871002",
"height": "129.0MM",
"percentageOfAlcoholByVolume": "0.0",
"dailyValueIntakeReference": "10 a day keeps the doctor away",
"allergenStatement": {
"de": "Enthalt: Milch (Laktose)",
"fr": "Contient: lait de vache (lactose)",
"en": "Bevat: koemelk (lactose)"
},
"isPackagingMarkedReturnable": "false",
"netContent": "325.0GR",
"regulatedProductName": "Babbelaars",
"itemThumbnail": "/a/16257a91e7c42b64fdc7ad91292dce85/babbelaars.png",
"packages": [
{
"height": "100.0CM",
"containedGtin": "90000000000003",
"gtin": "91000000000002",
"width": "50.0CM",
"netContent": "100.0EA",
"packageUnitIndicator": "CASE",
"depth": "60.0CM",
"containedAmount": "10",
"grossWeight": "109.0KG"
}
],
"isVariableUnit": "false",
"taxRate": "STANDARD",
"width": "67.0MM",
"targetMarket": "528",
"gpc": "10000005",
"nameOfInformationProvider": "LANSA",
"depth": "67.0MM",
"grossWeight": "350.0GR",
"nutrients": [{
"percentageOfDailyValueIntake":"0.1","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"1.0","quantityContainedHouseHoldServingSize":"10.0","quantityContainedUnit":"GR","nutrientTypeCode":"CHOAVL-"
},{
"percentageOfDailyValueIntake":"0.2","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"2.0","quantityContainedHouseHoldServingSize":"20.0","quantityContainedUnit":"E14","nutrientTypeCode":"ENER-"
},{
"percentageOfDailyValueIntake":"0.3","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"3.0","quantityContainedHouseHoldServingSize":"30.0","quantityContainedUnit":"GR","nutrientTypeCode":"FASAT"
},{
"percentageOfDailyValueIntake":"0.4","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"4.0","quantityContainedHouseHoldServingSize":"40.0","quantityContainedUnit":"KJO","nutrientTypeCode":"ENER-"
},{
"percentageOfDailyValueIntake":"0.5","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"5.0","quantityContainedHouseHoldServingSize":"50.0","quantityContainedUnit":"GR","nutrientTypeCode":"FIBTG"
},{
"percentageOfDailyValueIntake":"0.6","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"6.0","quantityContainedHouseHoldServingSize":"60.0","quantityContainedUnit":"GR","nutrientTypeCode":"PRO-"
},{
"percentageOfDailyValueIntake":"0.7","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"7.0","quantityContainedHouseHoldServingSize":"70.0","quantityContainedUnit":"GR","nutrientTypeCode":"FAT"
},{
"percentageOfDailyValueIntake":"0.8","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"8.0","quantityContainedHouseHoldServingSize":"80.0","quantityContainedUnit":"GR","nutrientTypeCode":"SUGAR-"
},{
"percentageOfDailyValueIntake":"0.9","measurementPrecision":"APPROXIMATELY","quantityContainedServingSize":"9.0","quantityContainedHouseHoldServingSize":"90.0","quantityContainedUnit":"GR","nutrientTypeCode":"SALTEQ"
}],
"ingredientStatement": {
"de": "Zucker, Glukosesirup, Zuckersirup, Butter (3%), Salz.",
"fr": "sucre, sirop de glucose, sirop de sucre, beurre (3%), sel.",
"en": "sugar, glucose syrup, sugar syrup, butter (3%), salt."
},
"isItemReturnable": "false",
"shortDescription": {
"en": "Babbelaars"
},
"allergens": [
{
"allergenTypeCode": "BB",
"levelOfContainment": "CONTAINS"
}
],
"contactName": "LANSAEU1169",
"startAvailabilityDate": "2015-05-19",
"myattribute": "MyPostedEach",
"minimumLifespanFromTimeOfArrival": "8",
"householdServingSize": "household serving size",
"isDispatchUnit": "false",
"isBasePriceDeclarationRelevant": "false",
"allergenSpecificationAgency": "EU",
"isOrderableUnit": "false",
"allergenSpecificationName": "1169/2011",
"additives": [
{
"additiveName": "additive sample name",
"levelOfContainment": "CONTAINS"
}
],
"minimumLifespanFromTimeOfProduction": "10",
"baseUnitIndicator": "BASE_UNIT_OR_EACH",
"effectiveDate": "2015-05-19",
"servingSize": "GR",
"countryOfOrigin": "528",
"preparationType": "PRESSURE_COOKING",
"supplierItemNumber": "324324234",
"gtin": "90000000000003",
"pallets": [
{
"palletTypeCode": "37",
"height": "10.0MR",
"optionalGtin": "92000000000001",
"containedGtin": "91000000000002",
"palletTermsAndConditions": "3",
"width": "250.0CM",
"quantityOfLayersPerPallet": "5",
"palletUnitIndicator": "PALLET",
"depth": "120.0CM",
"containedAmount": "50",
"grossWeight": "1200.0KG",
"logisticsUnitStackingFactor": "10"
}
],
"barCodeType": "EAN_UCC_13_SYMBOL",
"nameOfManufacturer": "LANSA",
"compulsoryAdditivesLabelInformation": {
"de": "comp add label",
"fr": "comp add label",
"en": "comp add label"
},
"isInvoiceUnit": "false",
"isConsumerUnit": "true",
"packagingTypeCode": "CAN",
"communicationAddress": "Leliehof 26, 4841 ML PRINSENBEEK",
"itemImage": "/a/d59455129b92fb21dd00a97746a81439/babbelaars.png",
"isPackagingExemptFromRefuseObligation": "NOT_APPLICABLE"
}
Could you help me with this, I'm trying to get all keys and nested keys to create a dynamic conversion of values. Thanks in advance, Greetings Danny
The text was updated successfully, but these errors were encountered: