← Back to blog
Cleanup

How to Clean Up Messy API Responses

Remove nulls, trim whitespace, and normalize inconsistent API payloads before using them downstream.

2026-02-253 min readUpdated Apr 1, 2026

API responses can be valid JSON and still be annoying to work with. They often include null values, empty fields, inconsistent whitespace, or noisy structure that makes the next step harder than it should be.

If you pass that response straight into an automation or save it as-is, you can end up carrying a lot of unnecessary mess through the rest of the workflow.

Problem

Imagine you receive customer or user profile data from a third-party API. The payload contains useful information, but it also includes empty fields, trailing spaces, and inconsistent formatting from one response to the next.

That becomes a problem when you want to:

  • store the response cleanly
  • compare changes over time
  • pass the data into another API or workflow step
  • avoid downstream logic that has to keep handling edge-case noise

The JSON still works, but it is harder to trust and harder to reuse.

Solution

Forge Json's Clean JSON utility lets you normalize the response in one pass before it moves downstream.

Use it like this:

  1. Paste the raw API response into Forge Json.
  2. Enable the cleanup rules you want, such as removing nulls and trimming strings.
  3. Run the transformation.
  4. Use the cleaned output in your app, ETL job, or storage layer.

The cleaned result is easier to compare, easier to inspect, and more predictable when you pass it into another system.

_Screenshot placeholder: show the messy API response on the left and the cleaned JSON output on the right._

This is a practical cleanup step whenever API data needs to move into a UI, queue, database, or automation workflow without carrying unnecessary noise with it.

Support material

Practical example and product context

Use these examples to understand the transformation and apply the same workflow in your own JSON tasks.

Example Transformation

Input
1{
2 "users": [
3 {
4 "id": 1,
5 "name": " Alice Johnson ",
6 "email": "alice@example.com",
7 "phone": null,
8 "bio": "Software engineer ",
9 "tags": [],
10 "address": {
11 "street": "123 Main St",
12 "city": "Portland",
13 "state": "OR",
14 "zip": "97201",
15 "apartment": null
16 },
17 "preferences": {
18 "newsletter": true,
19 "theme": "dark",
20 "language": "",
21 "notifications": null
22 }
23 },
24 {
25 "id": 2,
26 "name": "Bob Smith",
27 "email": "bob@example.com ",
28 "phone": null,
29 "bio": "",
30 "tags": [
31 "developer",
32 "mentor"
33 ],
34 "address": {
35 "street": "456 Oak Ave ",
36 "city": "Seattle",
37 "state": "WA",
38 "zip": "98101",
39 "apartment": ""
40 },
41 "preferences": {
42 "newsletter": false,
43 "theme": " light ",
44 "language": null,
45 "notifications": []
46 }
47 }
48 ]
49}
Config
1{
2 "removeNulls": true,
3 "removeEmptyStrings": true,
4 "removeEmptyArrays": true,
5 "trimStrings": true,
6 "sortKeys": true
7}
Output
1{
2 "users": [
3 {
4 "address": {
5 "city": "Portland",
6 "state": "OR",
7 "street": "123 Main St",
8 "zip": "97201"
9 },
10 "bio": "Software engineer",
11 "email": "alice@example.com",
12 "id": 1,
13 "name": "Alice Johnson",
14 "preferences": {
15 "newsletter": true,
16 "theme": "dark"
17 }
18 },
19 {
20 "address": {
21 "city": "Seattle",
22 "state": "WA",
23 "street": "456 Oak Ave",
24 "zip": "98101"
25 },
26 "email": "bob@example.com",
27 "id": 2,
28 "name": "Bob Smith",
29 "preferences": {
30 "newsletter": false,
31 "theme": "light"
32 },
33 "tags": [
34 "developer",
35 "mentor"
36 ]
37 }
38 ]
39}
Built with Cleanup utility
View full documentation and more examples in the Store
View in Store

Related Articles

Continue with another practical guide in the same workflow area.