I am trying to extract a valid json from text using Siddhi json Execution API. I have downloaded siddhi-execution-json-1.1.1.jar from wso2 store and following the example mentioned in the documentation there. But the same syntax above is not giving error of "Syntax error in SiddhiiQl, mismatched input 'input' expecting {',',GROUP,ORDER,LIMIT....}" . Below is my synatx:
@info(name='query_name')
from transact#window.length(1)
select json:group("json",true) as groupedJSONArray
input transact2;
I am using the below text from transact stream :
data: "" {
"_id": {
"$oid": "fr4wfwe4"
},
"code": "fesfsce",
"name": "NAME1",
"desc": "DECRIPTION",
"transRefId": "FESFCSEFCS",
"amount": 1000,
"currency": "USD",
"sender": {
"id": "FRESGVSVDVEFE2333",
"name": "rose",
"phone": "123456789"
},
"message": "",
"lockedBy": {},
"activatedBy": {},
"statusChangedAt": "",
"linkBankTrans": null,
"devGrp": 0,
"requestId": "",
"codeStatus": null,
"codeTransRefId": null,
"extOriginTransId": null
}
""
For reference , i am generating transact stream via below query:
@info(name = 'clean payload with replaceall')
from transactionstream1
select str:replaceAll(payload,"\\","") as data
insert into transact;
I want to extract the valid json inside data:" " in WSO2 stream processor. Is there some other extension i should use or there is some error in the way i am executing? I need this query above: @info(name='query_name') to work to get json from the above text.