ContributionsMost RecentMost LikesSolutionsRe: Replace a single key in a json object $.mapKeys((value, key) => key == ‘Field1’ ? ‘NEWNAME’ : key) has worked fine for me. Also the approach I was using already is the 2 mapper approach you have suggested. One mapper for copying and second to delete. But I thought if we use this $.mapKeys approach, we can do this with one mapper right. Thats why was thinking of the $.mapKeys approach. Anyway Thanks a lot for that!! 🙂 🙂 Replace a single key in a json object Hi All, I want to replace just one keyname with another name. For example: initial input : { “Field1”: “bar”, “Field2”: “bar” } desired output : { “NEWNAME”: “bar”, “Field2”: “bar” } I checked the docs and saw that we can use $.mapKeys to play with the keys. https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439367/Object+Functions+and+Properties#ObjectFunctionsandProperties-mapKeys But I was not successful in changing the key. Whenever i tried, it was appending to all the keys in the object. $.mapKeys((value, key) => “NEWNAME” + key) When i used the below syntax, its giving only one key as output. $.mapKeys((value, key) => “NEWNAME” + key) Please help me to change just the name of a single key in the object. Thanks in Advance. Re: File Poller: Get files without extension Hi… I don’t want all the files… I want only the files which do not have any extensions… Many of the files in that folder do not have any extension. I just want those files. File Poller: Get files without extension Hi All, I am using a file poller snap. In the file filter, what should I give so that I get files with no extensions? So if I use *.txt I get text files. Similarly, to get files without any extension, what should I give? The folder that I am searching will be having many files with extensions. I just want the files without any extensions. Thanks in Advance! Kafka Consumer Crash Hi All, If I am using a Confluent Kafka Consumer Snap and it crashes in between, Will it commit an offset? For example if there are 500 documents in Kafka and after reading 250 documents Kafka crashes. Will it read from the 251st document when I run it again or will it start from the 1st document in the next try? Re: Create array using script snap Thank You so much. It helped. 🙂 Create array using script snap Hi Everyone, I have written a simple javascript code in Script snap. Please find the code below: script = { execute : function() { while (input.hasNext()) { var test = [“a”, “b”]; try { output.write(test); } catch(err) { new_data.errMsg = err.message; new_data.tryBlock = "failed"; error.write(new_data); } } } }; var hook = new com.snaplogic.scripting.language.ScriptHook(script) I am basically just creating an array with values [“a”, “b”] and printing it. Please find the output below: But in the output, you can see that it has become an object {0:a, 1:b} with keys as “0” and “1”. Please help me with this. How can I get an array [“a”, “b”] as the output? Re: Convert array to object Thanks a lot… It helped… Convert array to object The output is of the above form. Here root element(Array) is of the form of an array. How do we make it of the form of an object? To get the idea of the json form, the above is the json view of the output. In that, you can see that “d” is an array. I want the output to be of the above form. Please do help. Thanks in advance.