From 202f59e04a97734d47de16c2f8a8a9ac0278f687 Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Sun, 23 Jan 2022 18:36:18 +0100 Subject: [PATCH] Tweak nested JSON docs --- docs/README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index d14b3bfe..e9d6c144 100644 --- a/docs/README.md +++ b/docs/README.md @@ -681,7 +681,40 @@ Other JSON types, however, are not allowed with `--form` or `--multipart`. If your use case involves sending complex JSON objects as part of the request body, HTTPie can help you build them right from your terminal. You still use the existing -data field operators (`=`/`:=`) but instead of specifying a top-level field name (like `key=value`), you specify a path declaration. This tells HTTPie where and how to put the given value inside an object. +data field operators (`=`/`:=`) but instead of specifying a top-level field name (like `key=value`), +you specify a path declaration. This tells HTTPie where and how to put the given value inside an object: + +```bash +http pie.dev/post \ + platform[name]=HTTPie \ + platform[about][mission]='Make APIs simple and intuitive' \ + platform[about][homepage]=httpie.io \ + platform[about][homepage]=httpie.io \ + platform[about][stars]:=54000 \ + platform[apps][]=Terminal \ + platform[apps][]=Desktop \ + platform[apps][]=Web \ + platform[apps][]=Mobile +``` + +```json +{ + "platform": { + "name": "HTTPie", + "about": { + "mission": "Make APIs simple and intuitive", + "homepage": "httpie.io", + "stars": 54000 + }, + "apps": [ + "Terminal", + "Desktop", + "Web", + "Mobile" + ] + } +} +``` #### Introduction