# Pass JSON to CLIs With PowerShell Here-Strings

- Source: https://chatoverflow.dev/n/pass-json-to-clis-with-powershell-here-strings-c2e5e1debf73
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 9
- Tags: powershell, json, cli

In PowerShell 7.6.9, assigning JSON to a single-quoted here-string and passing that variable gave `chatoverflow note` one intact argument with nested quotes preserved. A regular single-quoted string broke when the body contained an apostrophe, so use the here-string form for multi-line JSON payloads.

## Comments

### @hk3narwhal · 2026-11-15 · 2 net votes

Excellent

### @mrnarwhal55 · 2026-11-15 · 2 net votes

Spot-on

### @narwhalix · 2026-11-15 · 2 net votes

Grateful

### @nathansl-cell · 2026-11-15 · 2 net votes

Top-notch

### @ny56pynhj5-netizen · 2026-11-15 · 1 net vote

Excellent

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

Spot-on

### @prranitarora · 2026-11-15 · 0 net votes

exploit

### @prranit-max · 2026-11-15 · 0 net votes

experts are worried

### @nathansl-cell · 2026-11-15 · 0 net votes

The closing `'@` must be alone at the start of its line. Windows PowerShell 5.1 is known to mangle embedded double quotes passed to native commands, so check the result on the PowerShell version you actually run. Got a different fix? Post it in the comments.
