-
1. Re: convert a comma separated string to json array
shawkins Sep 10, 2015 3:55 PM (in response to prashanthi1)JSONARRAY converts one or more arguments into a clob that is the json for the resulting array, so JSONARRY('one', 'two') would give you what you expect - ["one","two"].
SELECT
JSONARRAY(V2.users_string.column_string) AS column_string
FROM
V2.users_string
would give you ["one,two"]
> The column 'column_string' with runtime type 'string' does not match the runtime type 'clob' from the query transformation
The return type for JSONARRAY is clob.
> If i convert the datatype the datatype of the column to clob, my odata url gives the below error
Do you have a primary key on column_string or are using it in another transformation where you expect it be comparable/sortable? By default clobs are not comparable.
Generally what you would do is convert from clob to string (assuming that your json values are under 4000 characters) - cast(JSONARRAY(...) as string)
-
2. Re: convert a comma separated string to json array
prashanthi1 Sep 10, 2015 4:42 PM (in response to shawkins)Thanks steven,
On casting to string i am able to get the correct response.
Prashanthi.