enhancement: merge two json objects
See original GitHub issueAs offered here: https://stackoverflow.com/questions/50580415/karate-array-field-become-object
by @ptrthomas
Maybe we need a karate.append() and karate.merge() (for merging 2 JSON objects). Feel free to raise a feature request.
I would love to see a merge function. I have data driven tests where not all assertions in the test data files are mandatory, and I’d like to merge a “default” json with them, allowing the values in the file to override these defaults.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
merge two json objects · Issue #774 · karatelabs/karate - GitHub
enhancement : merge two json objects #774 ... Maybe we need a karate.append() and karate.merge() (for merging 2 JSON objects).
Read more >Merge two json objects with jquery - Stack Overflow
I have been looking for a way to combine these two objects into one object. Thanks in advance. jquery · ajax · json...
Read more >JavaScript merge JSON objects - techtutorialsx
In this tutorial we will learn how to merge two JSON objects using JavaScript. We will assume that we are starting from two...
Read more >How to Merge Json Objects in Snowflake? - DWgeek.com
In this article, we will check how to merge two json objects in ... Note that, you can enhance this UDF to merge...
Read more >Solved: Merge 2 Json files - Alteryx Community
Solved: I have 2 different JSON files which I want to merge as shown ... to be an array not 2 separate JSON...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thunderstumpges done
Wow, thanks! That has GOT to be the fastest turnaround on a feature request ever! 😃
Yes I have looked at
contains
and fuzzy matching. I actually do use fuzzy matching in a number of places. I ran into friction with contains, as the parts being asserted in the response are nested in fairly complex ways, and I didn’t want the test writers to have to replicate that nesting in their test data. I did also look intokarate.map
but with the “optional-ness” of the assertions, I didn’t see how to “optionally map” into the response structure.I do have a working solution in place, and I think the above will help even more with this, so Thanks!
But for those curious, below is an example of my scenario. Test writers fill in test data in
yaml
files which drive the tests:Test Yaml:
And when matching to the response, the nesting is more complex: