Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
iztoogood
Contributor III
Contributor III

json out element namming problem

hello,

thanks to the explaination of the topic

39421#M11049

i've manage to out a json structured like this :

0683p000009M0O1.png

[
	{
		"key": "1",
		"key_datas": {
			"key_date": "2018-06-30T23:02:00"
		}
	},
	{
		"key": "2",
		"key_datas": {
			"key_date": "1974-06-30T12:30:00"
		}
	},
	{
		"key": "3",
		"key_datas": {
			"key_date": "2006-09-04T11:30:00"
		}
	}
]

but in need to out the "key_date" element as : "date(date_key)"

that mean a full out like this :

[
	{
		"key": "1",
		"key_datas": {
			"date(key_date)": "2018-06-30T23:02:00"
		}
	},
	{
		"key": "2",
		"key_datas": {
			"date(key_date)": "1974-06-30T12:30:00"
		}
	},
	{
		"key": "3",
		"key_datas": {
			"date(key_date)": "2006-09-04T11:30:00"
		}
	}
]

the only ugly solution i've found is to string replace with a tJavarow

String jsonStrReplaced = row3.json;
jsonStrReplaced =StringHandling.CHANGE(jsonStrReplaced, "key_date", "date(key_date)");
output_row.jsonStrReplaced = jsonStrReplaced;

do any one has a smarter solution ?

when i try a to name it in tWriteJsonField, i have a

rg.xml.sax.SAXParseException

Labels (5)
2 Replies
vapukov
Master II
Master II

always possible to find bypass (like You already do), but always better to talk with developers about following standards:

 

http://jsonapi.org/format/#document-member-names

 

The following characters MUST NOT be used in member names:

...
U+0025 PERCENT SIGN, “%”
U+0026 AMPERSAND, “&”
U+0027 APOSTROPHE, “’”
U+0028 LEFT PARENTHESIS, “(“
U+0029 RIGHT PARENTHESIS, “)”
...

 

 

iztoogood
Contributor III
Contributor III
Author

you are really right !!!

but in the true life... that's not always possible 🙂