Skip to main content
Question

How to delete json key by JSONUpdater


endest
Contributor
Forum|alt.badge.img+1

Hi,

=============================

How to delete the key "x" in a json attribute by JsonUpdater transformer:

{ "x" : "aa", "y" : "bb" }

=============================

I send the feature both into the ports of "Document" and "Update", and set

Update Type: "Delete From Object"

JSON Path: json[*]

Object / Array Index: x

=============================

but get warnings below:

2016-06-16 17:27:38| 0.2| 0.2|WARN |JSONUpdater(XQueryFactory2): The following error occurred while executing query number 1:

2016-06-16 17:27:38| 0.2| 0.0|WARN |JSONUpdater(XQueryFactory2): The following error occurred near line 3, column 21 of the query:

2016-06-16 17:27:38| 0.2| 0.0|WARN |JSONUpdater(XQueryFactory2): xs:string can not be promoted to parameter type json-item() of function json-item-accessor()

=============================

Thanks

3 replies

takashi
Influencer
  • June 16, 2016

Hi @endest, json[*] indicates any member belonging to the root value, so your setting means "remove x from any member object contained by the root". You can set just json to the JSON Path to indicate the root. Try this.

  • JSON Path: json

helmoet
Forum|alt.badge.img+8
  • December 6, 2016
Works fine!

martinkoch
Supporter
Forum|alt.badge.img+18
  • Supporter
  • August 7, 2019
takashi wrote:

Hi @endest, json[*] indicates any member belonging to the root value, so your setting means "remove x from any member object contained by the root". You can set just json to the JSON Path to indicate the root. Try this.

  • JSON Path: json

And again... Takashi saves my day ;-)

I started off with json[*] and no result, but now it makes sense...


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings