Error when extracting fields from json file - unbound prefix

Four Stars

Error when extracting fields from json file - unbound prefix

Hi,

I'm trying to extract the fields "name", "type", "value" and "showvalues" from the json code below:

"categories": [{
	"id": "ident1",
	"properties": {
		"SP:name": {
			"name": "Name",
			"type": "String",
			"value": "value1",
			"showvalues": "showvalue1"
		}
	}]

by using the component tExtractJSONFields. My basic component settings look as follows:

 

basic_settings_picture.png

When I run the job, I get the error message "Unbound prefix: SP". It works when deleting the "SP:" in the JSON file, but tha is not a permanent solution.

Any ideas how to solve this? Thanks in advance!

 


Accepted Solutions
Community Manager

Re: Error when extracting fields from json file - unbound prefix

Hi
Before tExtractJsonfield, you can remove "SP:" using java code on tjavaRow. eg:
...tJavaRow--main--tExtractJsonfield....
on tjavaRow:
output_row.columnName=input_row.columnName.replaceAll("SP:","");

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: Error when extracting fields from json file - unbound prefix

Hi
Before tExtractJsonfield, you can remove "SP:" using java code on tjavaRow. eg:
...tJavaRow--main--tExtractJsonfield....
on tjavaRow:
output_row.columnName=input_row.columnName.replaceAll("SP:","");

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: Error when extracting fields from json file - unbound prefix

Hi Shong,

 

thanks for your answer, it worked perfectly.

 

Regards

weeze

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now