Hitachi Vantara Pentaho Community Forums
Results 1 to 1 of 1

Thread: JSON Input - JSON with sub-nodes

  1. #1
    Join Date
    Feb 2010
    Posts
    19

    Default JSON Input - JSON with sub-nodes

    Hi there,

    This is the first time that I use the Json input step to import data and I always get an error related to the sub-nodes.

    I think the problem is that I have 1 order with many products but I don't know how to fix it. Would someone help me?

    Error:
    Code:
    2011/09/27 08:33:02 - Spoon - Transformation opened.
    2011/09/27 08:33:02 - Spoon - Launching transformation [importa_json]...
    2011/09/27 08:33:02 - Spoon - Started the transformation execution.
    2011/09/27 08:33:02 - Transformation metadata - Natural sort of steps executed in 0 ms (2 time previous steps calculated)
    2011/09/27 08:33:04 - Spoon - The transformation has finished!!
    2011/09/27 09:42:14 - org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta@273fe4e4 - ERROR (version 4.2.0-stable, build 15748 from 2011-09-08 13.11.42 by buildguy) : Não foi possível obter os campos de steps anteriores devido a um erro
    2011/09/27 10:05:34 - D:\etl_process\importa_json.ktr : importa_json - Expedindo início para transformação [D:\etl_process\importa_json.ktr : importa_json]
    2011/09/27 10:05:36 - Json Input.0 - ERROR (version 4.2.0-stable, build 15748 from 2011-09-08 13.11.42 by buildguy) : Could not open file #1 : file:///D:/data.js --> org.pentaho.di.core.exception.KettleException: 
    2011/09/27 10:05:36 - Json Input.0 - ERROR (version 4.2.0-stable, build 15748 from 2011-09-08 13.11.42 by buildguy) : The data structure is not the same inside the resource! We found 2594 values for json path [$..data_items..product_code], which is different that the number retourned for path [$..id] (2578 values). We MUST have the same number of values for all paths.
    2011/09/27 10:05:36 - Json Input.0 - Finished processing (I=0, O=0, R=0, W=0, U=0, E=1)
    2011/09/27 10:05:36 - D:\etl_process\importa_json.ktr : importa_json - D:\etl_process\importa_json.ktr : importa_json
    2011/09/27 10:05:36 - D:\etl_process\importa_json.ktr : importa_json - D:\etl_process\importa_json.ktr : importa_json
    JSON's structure:
    Code:
    {"orders":{
    	"order":[
    		{
    		"data":{
    			"date":"2011-09-01",
    			"status_id":2,
    			"id":"53788",
    			"data_items":{
    				"data_item":[
    					{
    					"unit_price":"9.99",
    					"product_code":"1191",
    					"name":"MOUSEPAD",
    					"quantity":"1"
    					},{
    					"unit_price":"19.99",
    					"product_code":"1192",
    					"name":"HEADPHONE",
    					"quantity":"1"
    					},
    				]
    			}
    		},
    		"customer":{
    			"name":"JHON DOE",
    			"email":"jhon@doe.com",
    			"id":"99"
    		},
    		"contacts":[
    			{"type":"PHONE","value":"9999999999"},
    			{"type":"MOBILE","value":"3333333333"}
    		],
    		"addresses":[
    			{"type":"D",
    			"zip_code":"",
    			"street_name":"AV PAULISTA",
    			"street_number":"1799",
    			"city":"SAO PAULO",
    			"state":"SP",
    			"country":"BRA"
    			}
    		],
    		"payment":{
    			"payment_method":"CREDIT CARD",
    			"status":"OK",
    			"payment_date":"2011-09-01",
    			"payed_value":"29.98"
    			}
    		}]
    	}
    }
    JSON Input Step:
    https://www.dropbox.com/s/f1kgm46021...json_input.png


    Thanks!
    Gilmar
    Last edited by momagi; 09-27-2011 at 09:15 AM. Reason: add JSON Input Step

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.