Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for modifying nodes like in jq #51

Open
ghostbuster91 opened this issue Sep 25, 2023 · 0 comments
Open

Add support for modifying nodes like in jq #51

ghostbuster91 opened this issue Sep 25, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ghostbuster91
Copy link

Problem Statement

Sometimes I need to modify an xml file from the script. I could use sed but IMO it is error prone as it does not understand xml structure.

jq supports modifying values as follows:

$ curl https://dummyjson.com/products/1  | jq '.id=2'  
{
  "id": 2, # this was originally 1
  "title": "iPhone 9",
  "description": "An apple mobile which is nothing like apple",
  "price": 549,
  "discountPercentage": 12.96,
  "rating": 4.69,
  "stock": 94,
  "brand": "Apple",
  "category": "smartphones",
  "thumbnail": "https://i.dummyjson.com/data/products/1/thumbnail.jpg",
  "images": [
    "https://i.dummyjson.com/data/products/1/1.jpg",
    "https://i.dummyjson.com/data/products/1/2.jpg",
    "https://i.dummyjson.com/data/products/1/3.jpg",
    "https://i.dummyjson.com/data/products/1/4.jpg",
    "https://i.dummyjson.com/data/products/1/thumbnail.jpg"
  ]
}

It would be great to have the same provided by xq.

@ghostbuster91 ghostbuster91 added the enhancement New feature or request label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants