Choose one: Hardware, Software, Coding, Game, or Windowsโฑ๏ธ 2 min read๐Ÿ“… 2026-06-03

How to Fix: How do I update a single value in a json document using jq?

SEO meta description 140-155 characters.

Quick Answer: 1-2 sentences of direct conversational advice.

To update a single value in a JSON document using jq, you can use the following command:

๐Ÿ›‘ Updating a Single Value with jq

  • Use the `.[]` syntax to update an array value:

Example 1: Updating a Single Value in an Array

curl http://example.com/shipping.json | jq '.items[] |= . + { field: value }' | curl -X PUT http://example.com/shipping.json

Example 2: Updating a Single Value in an Object

curl http://example.com/shipping.json | jq '.field = value' | curl -X PUT http://example.com/shipping.json

๐Ÿ› ๏ธ Step-by-Step Verified Fixes

Method 1: [Name]

  1. Step 1: Use the `.[]` syntax to update an array value.

Method 2: [Name]

  1. Step 1: Use the `.` syntax to access a nested object.

๐ŸŽฏ Final Words

[Wrap-up]

Did this fix your problem?

If not, try searching for specific error codes.

๐Ÿ” Search Error Database

โ“ Frequently Asked Questions