answerstu

jython - POST error when sending JSON data in Grinder

The requirement is to make a POST request to a particular URL with a given JSON payload. The URL will only respond if the payload is correct and the request is via POST.This is my code:request1 = HTTPRequest()control = HTTPPluginControl.getConnectionDefaults()httpUtilities = HTTPPluginControl.getHTTPUtilities()control.setProxyServer("proxy.example.com", 1234)payload = JSONObject({ "uaaURL": "https://com-example.something.com", "sampleID": "admin", "sampleSecret": "password", "sampleID2": "example-sample-el", "sampleSecret2": "ssenjsoemal/+...Read more

Mapping JSON objects to display data on the template [ANGULAR 4]

I'm preparing to display data from JSON I get from the server. I'm still learning angular ang what I know now is that I should map JSON answer to object but I do not exactly how to do that. From now I can type ID of my object and display single data on my template. I'd like to display list of objects from my JSON using ngFor directive. My JSON:[{ "idinvestment": 6, "title": "Gdańsk Wrzeszcz, Jaśkowa Dolina 72", "description": "Oferujemy 6 nieprzechodnich 1-osobowych i 2-osobowych pokoi w świeżo wyremontowanym mieszkaniu. Każdy pokój za...Read more

XML to JSON in Camel Routing not working

I am trying to convert the XML message to JSON using camel router and save it into a file. Getting the XML message from the source and saving it to destination file etc are working. But when I try to convert to JSON, it did not work. I did not even throw any error/exception in logs. I am running on OSGI container public class CamelRouter extends RouteBuilder { @Override public void configure() throws Exception { from("file://C:/test/Sample.xml") .routeId("file-to-file") .log(LoggingLevel.INFO,"RouteI...Read more

json - Is there a way in Postman to change xml2Json conversion rules?

I have multiple instances where I need to convert my XML response, and in multiple cases I have nodes that appear once or more times. If it looks like this bbb will be just another element:<aaa> <bbb>ccc</bbb></aaa>and to get ccc value I have to access json like this: pm.response.json().aaa.bbbBut if XML looks something like this bbb will become array:<aaa> <bbb>ccc</bbb> <bbb>ddd</bbb></aaa>and to get ccc value I have to access json like this: pm.response.json().aaa.bbb[0]Later on, wh...Read more

postgresql - Retrieving json elements with a specific key name from a complex nested structure in postgres

I have a complex nested json structure in a postgres json field. I want to list all element values with key '$type' no matter where in the nested structure they appear. The structure contains arrays nested within arrays to several levels deep. What is the sql query I should use?The table structure is:create table if not exists documents( id text not null constraint documents_pkey primary key, value json not null)...Read more

json - REST API: how to post a manytomany relationship with fosrestbundle

In my Symfony 4 project, I have 2 entities: Question and PossibleAnswer. A question can have many possible answers and an answer can be used in many different questions.I want to POST a question, I use FOSRestBundle. This is how I would format the body of my request:{ "title": "my question", "possibleAnswers": [ { "id": 1, "title": "my first answer" } ]}At least this is how FOSRestBundle formats the answer when I create the data directly in the database and GET the question.But I keep getting the sam...Read more

How to POST JSON data with Curl from Terminal/Commandline to Test Spring REST?

I use Ubuntu and installed Curl on it. I want to test my Spring REST application with Curl. I wrote my POST code at Java side. However, I want to test it with Curl. I am trying to post a JSON data. An example data is like this:{"value":"30","type":"Tip 3","targetModule":"Target 3","configurationGroup":null,"name":"Configuration Deneme 3","description":null,"identity":"Configuration Deneme 3","version":0,"systemId":3,"active":true}I use this command:curl -i \ -H "Accept: application/json" \ -H "X-HTTP-Method-Override: PUT" \ -X POST -d ...Read more

angular - Set nested JSON Response as rowdata to ag-grid in Angular4

I am new to angular and doing a sample project in which I want to show some JSON data in a grid.I'm using ag-grid for the same.I have the following Json response that I'm getting from a rest API :-[ { "id": 64, "name": "Utopia", "language": "English", "genres": [ "Drama", "Science-Fiction", "Thriller" ], "status": "Ended", "image": { "medium": "http://static.tvmaze.com/uploads/images/medium_portrait/0/474.jpg", "original": "http://static.tvmaze.com/uploads/images/original_untouched/0/474.jpg" } }, { "id": 65, "name...Read more

json - Expandable rows with nested expandable values?

My data contains a column which its value is in JSON format.I would like to accomplish two things:Expand each row so its values are listed.Expand a specific value so if its value is in JSON format, the keys/values will be presented also in a nested list inside the list from item 1.For example:These are 3 different results:And this is the first result being expanded:Would appreciate your help....Read more

How to use jq @CSV filter to generate a csv file with values from different json levels

I have a JSON file from the Spotify API that lists all the songs on a specific album. The file is organized as follows:..name.tracks.items.tracks.items[].tracks.items[].artists.tracks.items[].artists[].name.tracks.items[].duration_ms.tracks.items[].nameI'm using jq to create a csv with the following information: song's artist, song's title, and song's duration. I can do this using the following syntax:jq -r '.tracks.items[] | [.artists[].name, .name, .duration_ms] | @csv' myfile.jsonOutput:"Michael Jackson","Wanna Be Startin' Somethin'",363400"...Read more

How to collate an array of JSON objects by a property into a struct containing vectors of each object's properties?

I am receiving a stream of sensor data which I need to aggregate and perform basic statistics on (average, max, min, etc.). There are multiple values but the sensor data can be inconsistent and some of the values can be missing. From reading the book, it seems like Option should be used when the values of luminosity or color are missing but I am confused about this.This is an example of my sensor data:[ { "sensor": "left", "luminosity": "50", "color": "(255,0,0)" }, { "sensor": "left", "color": "#0f0"...Read more

serialization - "invalid type: map, expected a sequence" when deserializing a nested JSON structure with Serde

I am trying to poll the GitHub API for issues and print them out. To do so, I need to deserialize a nested JSON structure that I receive from a cURL GET request.I am trying to get the url for all the objects in the items array:{ "total_count": 4905, "incomplete_results": false, "items": [ { "url": "https://api.github.com/repos/servo/saltfs/issues/789", "repository_url": "https://api.github.com/repos/servo/saltfs", "labels_url": "https://api.github.com/repos/servo/saltfs/issues/789/labels{/name}", "comments_url": "https://api....Read more

json - How do I write a Serde Visitor to convert an array of arrays of strings to a Vec<Vec<f64>>?

I need to deserialize a JSON into a struct that has a Vec<Vec<f64>> field. The JSON has strings for numbers so I need a custom deserializer to convert the strings to f64 during the deserialization.A sample JSON that I'd like to deserialize:{ "values": [["2", "1.4"], ["8.32", "1.5"]]}My struct is this:#[derive(Deserialize)]struct Payload { #[serde(default, deserialize_with = "from_array_of_arrays_of_strs")] values: Vec<Vec<f64>>,}I saw you could probably do this with visitors in the examples of Serde, so I've imple...Read more