How do I convert x-www-form-urlencoded into json data? - json

I am trying to convert x-www-form-urlencoded into json.
In the form I have a key and a value. Key as a queryFilter and the value corresponding to that. I also have a header as a cookie. When i tried in x-www-form-urlencoded it gives me right response.But it gives me 400 status when i tried as a raw in Json. Can any one please help me convert x-www-form-urlencoded to JSON?

Related

How to Access the data inside the JSON object. Some of my columns in pyspark dataframe is in JSON format

I was trying to access the data inside object. The table is in pyspark dataframe, but some table values are in JSON format. I need t access the date from it and convert into meaningful format. Any help or idea will be great relief.
This is thing i'm working out:
I was able to extract data which are in array format using:
data_df=df_deidentifieddocuments_tst.select("_id",explode("annotationId").alias("annotationId")).select("_id","annotationId.*")
The above code doesn't work for date, as its showing type mismatch error
AnalysisException: cannot resolve 'explode(createdAt)' due to data type mismatch: input to function explode should be array or map type, not struct<$date:bigint>;

How can I insert Dynamic JSON data into MySql DB with JSON data type?

I want to insert real time json payload into MySql DB. But I am unable to do so. I am trying to achieve it via mule 4. I am prompted the below error:-
Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.
Please help.
MySql DB expects String as parameter in the SQL statement. Your component sends data as object. Word "binary" indicates it.
Send data as String. Convert your JSON object to string as described here https://simpleflatservice.com/mule4/Object_as_string.html
Example:
%dw 2.0
var x={abc:"xyz","key":"value"}
output application/java
---
write(x,'application/json')

Custom Connector ( JSON result convert into Paramters )

List item
I am a newbie in the azure environment. I am getting JSON response from my custom connector but I need to convert that JSON into parameters so I can use these parameters in further actions Can anybody know how is this possible ?
You want to use these parameters in further actions but you don't mention which type it's stored.
1.Stored as string. In this way the whole json is a string, it's not supported to select property. So you need parse it to Json with Parse JSON action then you will be able to select property. About the Parse JSON Schema, just click the Use sample payload to generate schema and paste your json value, it will generate. And select your property just use the #{body('Parse_JSON')?['name']}, it will work.
2.If it's stored as an Object, just use expression variables('test1')['name'] to get it.

Read multiple JSONs from single REST Service response and put to Database Table - Talend

I have searched a lot but not found exact slution.
I have a REST service, in response of which I get rows and each row in a JSON, as given bellow:
{"event":"click1","properties":{ "time":"2 dec 2018","clicks":29,"parent":"jbar","isLast":"NO"}}
{"event":"click2","properties":{ "time":"2 dec 2018","clicks":35,"parent":"jbar3","isLast":"NO"}}
{"event":"click3","properties":{ "time":"2 dec 2018","clicks":10,"parent":"jbar2","isLast":"NO"}}
{"event":"click4","properties":{ "time":"2 dec 2018","clicks":9,"parent":"jbar1","isLast":"YES"}}
Each row is a JSON (all are similar to each other). I have a database table having all those fields as columns. I wanted to loop through these and upload all data in Talend. What I have tried is following:
tRestClient--tNormalize--tExtractJsonFields--tOracleOutput
and provided loop criteria and mapping in tExtractJsonFields component but it is not working and throwing me error saying "json can not be null or empty"
Need help in doing that.
Since your webservice returns multiple json objects in the response, it's not valid json but rather a json document.
You need to break it into individual json objects.
You can add a tNormalize between tRESTClient and tExtractJsonFields, and normalize the json document on "\n" character.
The error "json can not be null or empty" is due to an error in your Jsonpath queries. You have to set the loop query to "$", and reference the json properties using "event", "properties.time"
could you try this :
In your tExtractJsonFields, configure the property readBy to JsonPath without loop

Wiki API unable to parse JSON

I'm trying to access Wiki api with below query:
https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=india&gsrnamespace=0&gsrlimit=5&origin=*&prop=extracts&exchars=200&exlimit=max&explaintext=1&exintro=1
I'm getting response, but when I'm using JSON.parse to parse response Mozilla is displaying an error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Try this:
https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=india&gsrnamespace=0&gsrlimit=5&origin=*&prop=extracts&exchars=200&exlimit=max&explaintext=1&exintro=1&format=json
Add the format=json query parameter. Otherwise you're getting HTML with embedded JSON
Add finally format JSON string in url
https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=india&gsrnamespace=0&gsrlimit=5&origin=%2A&prop=extracts&exchars=200&exlimit=max&explaintext=1&exintro=1&format=json