question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Embedded expressions does not replace keys in JSON

See original GitHub issue

Related: https://github.com/intuit/karate/issues/512

Failing test below and in: https://github.com/ericdriggs/karate-key-template-bug

Feature:

  Scenario:

    * def key = 'Key'
    * def payload =
    """
    {
      #(key): 1
    }
    """
    * match payload == { Key: 1 }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Oct 19, 2020

@theathlete3141 yes 😉

1reaction
ptrthomascommented, Jul 6, 2019

@ericdriggs yes as per design, embedded expressions work only for values, not keys. here is what you need to do for your use-case:

* def key = 'Key'
* def payload = {}
* payload[key] = 1
* match payload == { Key: 1 }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Embeded expression doesn't work to replace key in JSON #512
lets say I am getting a value of a key from payload using get and assigning that as a value Def z =...
Read more >
Resolving Keys Embedded within JSON - The Couchbase Blog
There are two things we need to do: get the key value for the “_id” from the document and second is ensure that...
Read more >
Replace JSON key value without quotes - Stack Overflow
I have tried Embedded expression logic of #(temp) as well but it also does the same and makes it as a String with...
Read more >
OPENJSON (Transact-SQL) - SQL Server - Microsoft Learn
OPENJSON is a table-valued function that parses JSON text and returns objects ... If a column name does not match a key name,...
Read more >
JSON Configuration Syntax | Terraform - HashiCorp Developer
When a JSON string is encountered in a location where arbitrary expressions are expected, its value is first parsed as a string template...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found