I have to pass multiple records from a SQL source to the body of a web call in Data Factory in JSON format.
eg.
{"EmployeeCode":"1234",""FirstName":"Joe","LastName":"Bloggs"}
{"EmployeeCode":"5678",""FirstName":"Jack","LastName":"Ryan"}
However, I cannot seem to do it without ADF adding escape characters "\".
{\\"EmployeeCode\\":\\"1234\\",\\"\\"FirstName\\":\\"Joe\\",\\"LastName\\":\\"Bloggs\\"}"
So far I have tried:
Copy activity - Formatted SQL as JSON
Copy activity - SQL output to BLOB JSON
Copy activity - SQL concatenated string output
Does anyone have a process by which to achieve this? I am hoping I have missed something easy.
Thanks in advance....
Escape character backslash \ appears wherever double quotes " are used in the string in the Azure data factory.
Thank you #GregGalloway for your valuable input in the comments sections. As #GregGalloway mentioned, convert the string to JSON format in the web body as shown in the below example.
Example:
Source: SQL data
Getting SQL records using lookup activity.
Passing the output record to web activity in JSON format.
#json(activity('Lookup1').output.value[0].description)
The input of the web activity body is shown as below in JSON format:
Related
I am calling a web activity in a pipeline that is sending out an email (via Logic App).
Body of the email is being sent as a parameter from the ADF pipeline.
I am forming this body dynamically and want to embed new line characters in the body when i pass the string to the web activity.
Please suggest how can this be done.
P.S. I've tried embedding "\n" characters already and it is not working
According to Replacing special characters, the answer is something like this:
uriComponentToString('%0A')
Open the json code, make sure you are using "\n", instead of "\n"
I am receiving json string through an API from a website. However, the json format sent to me is not the format i want to work with. I want to change the received json string format to the desirable format.
This is the format i received:
{"symbols_returned":147,"base":"USD","data":{"AED":
3.673010,"AFN":75.392000,"ALL":109.685000}}
This however is the format i desire to have:
{"symbols_returned":147,"base":"USD","data":{"AED":"3.673010","AFN":"75.392000","ALL":"109.685000"}}
The difference between the former and latter is the presence of quotation marks on all the numeric currency values in the second json string. It can be seen that the first json string does not have quotes on the numeric currency values.
My question is how can i programmatically turn the first json string to the second json string format using dart programming language. Any help will be appreciated. Thanks
you need to parse the json data before you can use it.
you need to use the json package from dart:convert do do this
import 'dart:convert';
final yourResult = json.decode(API_RESULT);
print(yourResult) // {"symbols_returned":147,"base":"USD","data":{"AED":"3.673010","AFN":"75.392000","ALL":"109.685000"}}
will parse the json and preserve the data types and make that a Map
I have a spring service which renders JSP page. Spring controller sets JSON data in a request attribute, which i use in my JSP. Can anyone tell how can i parse this JSON data. I know if my web service response was a plain json , i can parse using jsonPath. But in my case JSON is a part of JSP. So I am kinda stuck.
You mean that your JSON is inside your HTML, probably in a Javascript variable?
And I guess using a regex to retrieve the elements your interested in is not enough and that you really want the JSON string?
If so, you can first use a regex check in order to extract your JSON content from your HTML. Beware that if your JSON string is on several lines, you might have to enable some regex features such as multiline or dotall. See
Then, you can transform your regex output into a JSON tree, using the check transform step. There, you can parse the JSON string with the engine of your choice. Gatling ships with json-smart.
Another solution is to build your own check. The procedure for Gatling 2 has been described in this thread on Gatling's Google Group.
When I try to parse ( http://www.roundmenu.com/webservices/index.cfm?ws=listrst&filter=featured ) webservice in json I encounter issues.
If any one can find out what the problem please let me know.
thanks in advance.
That’s not valid JSON. As usual, it’s useful to validate JSON input via http://jsonlint.com.
That particular JSON input fails to properly escape double quotes (\") inside strings.
Put the response in a json formatter like this one on curiousconcept.com. It yields many errors, does look like it's invalid json.
I am working with the iPhone SDK and I have to process a webservice response I receive from an external service.
The response data consists of an XML string that was UTF8-encoded to a byte array.
This byte array is converted to string
This string is put into a XML wrapper element
The wrapper is returned via an HTTP response
Therefore I need to know how to convert the response data back to the XML string it used to be. Unfortunately, I cannot change the way my response is created, so I have to deal with it somehow.
Example of the raw data I get from the webservice:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body><ExportBytesResponse xmlns="http://knowledgepark-ag.com/webservices/">
<ExportBytesResult>PERhdGE+PFJlY29yZCBEQj0iOTk5OTQiIEtleT0iMjA1Mjc0Ij48U2luZ2xlIEl0ZW1JZD0iQVJCUEFLRVQiIFZhbHVlPSIyOTAiIC8+PFNpbmdsZSBJdGVtSWQ9IkhET0tOUiIgVmFsdWU9IjIwNTI3NCIgLz48U2luZ2xlIEl0ZW1JZD0iVkVSQSIgVmFsdWU9IjEuNzEuMzIxMy4xNzU3NyIgLz48U2luZ2xlIEl0ZW1JZD0iRElTIiBWYWx1ZT0iR2VNLCBNw6RyIDEwIDIwMDggIDU6NDFQTTomI3hEO1ouenQuIGV4aXNpdGVydCBrZWluZSBNw7ZnbGljaGtlaXQgZGFzIEJlZW5kZW4gZWluZXMgTW9kdWxzIGR1cmNoIEFiYnJlY2hlbiBvZGVyIEhhcmQtQ2xvc2UtWCB6dSBlcmZhaHJlbi4gQW4gZGllc2VyIFN0ZWxsZSBtw7xzc3RlbiBtZWlzdCBVc2VydmFycyBkZXMgTW9kdWxzIGdlbMO2c2NodCB3ZXJkZW4uIE9kZXIgYW5kZXJlIEF1ZnLDpHVtYWt0aW9uIGR1cmNoZ2Vmw7xocnQgd2VyZGVuLiYjeEE7RUxLRUcgMDYuMDguMjAwOCAwOToyMToxNyYjeEE7JiN4QTsgQmVpc3BpZWxhdWZiYXUgOiYjeEQ7JiN4QTsmbHQ7Q2xv</ExportBytesResult>
</ExportBytesResponse></s:Body>
How do I get back my old xml string representation hidden inside these raw bytes?
Any help is highly appreciated, I feel just stupid right now for not being able to come up with a solution.
Best Regards,
David
ExportBytesResponse is Base64 encoded, so you must first decode that node using something like this.
That will give you an NSString containing the XML. Then you can use NSXMLParser to parse your data.