ContributionsMost RecentMost LikesSolutionsNumber is equal ""(empty string)? Hi there, Can someone explain to me why the following expression generates true as a result: I have the following pipeline: In JSON Generator I have: { "field": null } AutoPrep config: Data type is set to a number; if null, 0 (zero) will be the result value. Mapper: Shouldn’t this validate as false? The field is a number and has the value 0. The result after validation: Flatten multilevel/nested JSON Objects and Arrays Hello there, Is there a way to flatten a nested JSON (multiple objects inside objects/arrays) without using a Script Snap? Take this input for example: { "msg":"Hello, World", "num":1, "fruits":{ "apple":1, "orange":4, "inner2":{ "message":"found" }, "cars":[ "bmw", "audi", "dacia" ], "cars2":[ { "bmw":"something" }, { "audi":"else" } ] } } The output should look like this: { "msg": "Hello, World", "fruits.cars2.1.audi": "else", "fruits.orange": 4, "num": 1, "fruits.cars.1": "audi", "fruits.cars.0": "bmw", "fruits.apple": 1, "fruits.cars.2": "dacia", "fruits.inner2.message": "found", "fruits.cars2.0.bmw": "something" } So every key name is constructed from the inner objects/arrays of key names delimited with “.” in the case of objects. In the case of arrays, the key name should also have the index number of the current item. One way to do this is using the script snap using any available language. A function that loops through the root object and check the type of the current property. If it’s of type Object or array then I can call the function again. I’ve tried using expression libraries but with no luck. Any ideas? Re: Error 404 when doing a POST request to stop a pipeline Thank you! I need to pay more attention Error 404 when doing a POST request to stop a pipeline Hello, I am trying to terminate a running pipeline using Snaplogic API (according to the API Documentation) with POST snap but I get a 404 error every time. My snap settings: Error: The ruuid is correct (I’ve done a get request and I’ve got a response) and I’ve configured Basic Auth. Are there any settings that I need to make or am I doing something wrong? I’ll appreciate any help. SolvedRe: Change certain values inside an Array You are right, in this case it works but in my case I have an array of objects which I finally managed to work with this: jsonPath($, "$nested[*]").map(x => x.mapValues((value, key) => !isNaN(value) ? value * 10 : value)) Input: "nested": [{"m": "hey", "o": 10, "p": "hello", "q": 100}] Output: "nested": [{"m": "hey", "o": 100, "p": "hello", "q": 1000}] Thank you @koryknick for your guidance! Re: Change certain values inside an Array Yes but .map() function transforms every element from the Array, I only need to change the fields where there are numbers. Is there a way that I can use conditional logic inside of the .map() function?( if typeof value == ‘number’ then value * 10 else value Change certain values inside an Array Hello, I have this json: { "a": "Hello Word", "b": 1, "c": "some", "d": 10, "nested": [{ "m": "hey", "o": 10, "p": "hello", "q": 100 }] } I am trying to multiply each number field by 10 and the output structure needs to be the same. So far I’ve managed to get it worked for an Object using: $.mapValues((value, key) => !isNaN(value) ? value * 10 : value) but I don’t really know how can I do that for Arrays. Any tips? Thank you!