Retrieving a JSON object key with jsonPath
Hi everyone, i’m having troubles retrieving the key of a JSON object which is usually possible via the ~ sign. I hope the images render properly, this is possible via regular jsonPath, however i was not able to get that working with the jsonPath function in Snaplogic: Does anyone have an idea on how i can get my hands on the key of that object in Snaplogic? Sadly i’m only getting the object itself without the name: Best regards ThomasSolved19KViews0likes2CommentsJSON snap not working as expected
JSON splitter last week was working correctly. Pipeline was not edited, JSON format did not change, and yet Pipeline is crashing indicating error that JSON splitter is expecting list not an object. Before 17th of Feb it was working perfectly fine. was something changed in snap architecture? “Failure: Json Splitter expects a list, Reason: Found an object of type class java.util.LinkedHashMap, Resolution: The path $.data needs to refer to a list in the incoming document”Solved10KViews0likes16CommentsNull Safe access option for object value reference in JSON Generator snap?
Hi, I’m trying to reference a value from the input object in the JSON Generator snap. The property is optional in the upstream snaps. If I straight reference it, I’ll get an “Invalid JSON-Path field not found” error. Is there a similar way to the use “null-safe access” option like in the mapper snap in the JSON Generator snap? Is there a way to use the $.get() method in the JSON Generator snap? I keep getting syntax errors. Below is my property reference: $['wd:Project_Data']['wd:End_Date'] This fails: $['wd:Project_Data'].get("wd:End_Date") $['wd:Project_Data'].get(['wd:End_Date']) $.get(['wd:Project_Data']['wd:End_Date'])Solved9.6KViews0likes10CommentsI'm completely stuck trying to write JSON to CSV - it's been 4 days. Can anyone help?
I’m brand new to Snaplogic and this is probably really easy - sorry in advance! But I’ve been stuck on this since Thursday, and it’s now Tuesday… please help me. As a whole, I have this: In more detail: I have a JSON splitter, which has an output of the JSON I want to write to a CSV. And, if I preview the output in table view, it looks exactly like the CSV I want (I had an image here, but new users can only put one - sorry!). Previewing in JSON shows that it’s, well, JSON. After that, I have a CSV formatter, but I don’t have anything configured in it. Should I? The output view for this is more or less empty, so this clearly isn’t correct. I’ve tried JSON formatters and a million other things here. I just don’t know. Then I have my file writer (and as a bonus, I want only some of the fields from the JSON to be written to the CSV file). I can do it in Python: # Call the API r = requests.get(url_to_call, headers = headers) json_to_write = r.json() # Open a file for writing outfile = open(file_name,'w') writer=csv.writer(outfile) # Write CSV Header Row writer.writerow(["Id", "FirstName", "LastName"]) # Loop through each line of the JSON; print key values needed for x in json_to_write: writer.writerow([x["Id"], x["FirstName"], x["LastName"]]) I found this post on turning JSON to CSV by @dmiller and this post on writing a Twitter Query to a file, but as far as I can tell, those are just “use these snaps” without showing how the snaps are configured, and I’ve tried those configurations of snaps. I’m so lost. Any help appreciated.8.7KViews0likes9CommentsFlatten JSON files into CSV files
Created by @schelluri The pipeline pattern flattens a JSON file, which has multiple objects, and turns it into a CSV file. Configuration Sources: JSON Generator Targets: CSV file Snaps used: JSON Generator, JSON Formatter, JSON Parser, Script, CSV Formatter, File Writer Downloads MS_Flatten_Script.slp (31.4 KB)7.4KViews1like2CommentsJSON Object Diff
Is there a way to easily show what key values do not match between two JSON objects? If I have two objects with the same keys, can I output just the keys and values that do not match between the two objects? I am looking for a way to do this without having to create an equality expression for each key.7.3KViews0likes10CommentsJSON data size fix
My source data has more than 1M record which is in a csv format. All those records had error , hence were routed to error view. Now , All those records needs to be logged in a S3 folder. Also i send an email to the team which contains the file name and location. The data is loaded in a json format in S3 which is still fine but it takes a longer time to open the json file (which is obvious) but can we do this in a more efficient manner ?Sometime the log file does not load at all ☹️ Data must go to S3 folder but how we are storing it is open for discussion , like the records can be put in csv, txt or json format. I had an idea of Splitting those records and saving it as 2-3 json file but now sure , if it is even appealing. Any ideas ?Solved6.6KViews0likes5CommentsRemove emply/null value fields from JSON
Can you help me to remove empty/null value fields from a JSON structure? Kindly suggest pipeline design suggestion or expression language for the below expected results. Thanks! Input: { “INVOICE”: { “TITLE”: “Test”, “DESCRIPTION”: “Test124”, “VERSION”: “”, “IRN”: “”, “TRANDTLS”: { “TAXSCH”: “”, “SUPTYP”: “B2B”, “REGREV”: “”, “IGSTONINTRA”: “N” }, “NOTES”: { “ID”: “”, “TEXT”: “” } } } Expected Output { “INVOICE”: { “TITLE”: “Test”, “DESCRIPTION”: “Test124”, “TRANDTLS”: { “SUPTYP”: “B2B”, “IGSTONINTRA”: “N” } } }How to bring API JSON text into REST Post Snap?
Hi all, I am trying to use a JSON file to feed in the body of a response that is working in Postman with curl code like this: In SnapLogic I added the raw body in a JSON generator and want to feed that into a REST Post Snap. My pipeline looks like this: With no headers nor queries in Postman, only the JSON/raw body and the service URL, I retrieve results with no issues. However, with Snaplogic I am not receiving output. Has anyone done this? I am told I cannot incorporate the credentials into the headers, it must be in the body…but how do I reconcile this with SnapLogic? No one on my team has worked on something externalized that has functioned in this way. Thanks!6.2KViews0likes8CommentsCreate JSON from CSV file
Hi, I am new to snaplogic and want to create a JSON structure from a CSV file. CSV file data “Name”,“AddressLine1” “Test1234”,“122 Test St” The structure i need is very specific like: [ { “attributes”: { “Name”: [ { “value”: “Test1234” } ], “Addresses”: [ { “value”: { “AddressLine1”: [ { “value”: “122 Test St” } ] } }] }] Can someone help with a sample pipeline to create Json from CSV data5.9KViews0likes4Comments