Error parsing parameter '--expression-attribute-values' Invalid JSON Expecting property name enclosed in double quotes line 1 column 3 char 2
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The error "Invalid JSON: Expecting property name enclosed in double quotes" in the AWS CLI occurs when the --expression-attribute-values parameter receives malformed JSON. The most common cause is using single quotes around JSON keys instead of double quotes, or shell quoting issues that strip the double quotes before they reach the CLI. JSON requires all property names to be enclosed in double quotes ("key"), never single quotes ('key'). The fix depends on your operating system — Linux/macOS and Windows handle shell quoting differently.
The Error
The problem is {:uid: — the key :uid is not wrapped in double quotes. JSON requires {":uid":.
Fix: Proper JSON with Double-Quoted Keys
Common Mistakes and Corrections
Single quotes instead of double quotes
Missing quotes on keys
Trailing comma
Shell stripping double quotes
Multiple Expression Attribute Values
Note that DynamoDB number values must be passed as strings in JSON ("N": "30", not "N": 30).
Using file:// for Complex JSON
For complex expressions, put the JSON in a file to avoid quoting issues:
The file:// prefix reads JSON from a local file, eliminating all shell quoting problems.
Using the --cli-input-json Option
This puts the entire command input in a JSON file, which is the most maintainable approach for complex queries.
Validating JSON Before Sending
Common Pitfalls
- Single quotes around JSON keys: JSON strictly requires double quotes.
{'key': 'value'}is valid Python but invalid JSON. Always use{"key": "value"}. - Shell quoting differences between OS: On Linux/macOS, wrap JSON in single quotes. On Windows CMD, use escaped double quotes. On PowerShell, single quotes work. Use
file://to avoid all quoting issues. - Forgetting the colon prefix on attribute values: DynamoDB expression attribute values must start with
:(e.g.,:uid). The key in the JSON must include the colon:":uid", not"uid". - Using integer type for numbers: DynamoDB requires numbers as strings in the type descriptor:
{"N": "42"}, not{"N": 42}. The value of"N"must be a string containing the number. - Trailing commas in JSON: Unlike JavaScript, JSON does not allow trailing commas after the last element in an object or array.
{"a": 1, "b": 2,}is invalid JSON.
Summary
- The error occurs because JSON property names must be enclosed in double quotes
- On Linux/macOS, wrap the entire JSON value in single quotes to preserve inner double quotes
- On Windows, escape inner double quotes with backslashes or use single quotes in PowerShell
- Use
file://values.jsonfor complex expressions to avoid all shell quoting issues - Validate JSON with
jqorpython3 -m json.toolbefore passing it to the AWS CLI

