ROCLASI wrote:Hi Nick,
You can use the bundled Serialize plugin or the VelocityReport plugin. Both have functions to convert from a String to JSON and back.
Hope this helps.
I'm trying the plugins.serialize.fromJSON now, it did not show up when I entered JSON in the searchbar, but managed to find it after a while.
But I'm having some trouble, I'm trying to decode a json string I get form the database
- Code: Select all
var new_array = new Array( );
new_array = plugins.serialize.fromJSON( queue_json );
application.output( queue_json );
application.output( "array length " + new_array.length );
application.output( "string " + new_array.toString() );
application.output( "array 0 " + new_array[0] );
- Code: Select all
[{"sync_queue_id":"E8465A5B-D5C1-43C2-8FBF-1519031F7419","sync_table":"admin_value","sync_pk_col":"cmc_thid","sync_pk":"057BB27A-5FCD-4903-8A4B-6B892E75C835","time_changed":"2017-11-07T22:53:07.293Z","in_progress":1,"completed":0,"data_old":"{\"cmc_thid\":\"057bb27a-5fcd-4903-8a4b-6b892e75c835\",\"key_admin_value\":\"Warehousing/unit t-c\",\"value_numeric\":0.4}","data_new":"{\"cmc_thid\":\"057bb27a-5fcd-4903-8a4b-6b892e75c835\",\"key_admin_value\":\"Warehousing/unit t-c\",\"value_numeric\":0.5}","operation":"UPDATE"}]
array length 1
string [[object Object]]
array 0 [object Object]
I don't seem to get the array that I want, tried a few ways now. Any sugesstions?