ProxymanApp / ProxymanApp/Proxyman

JSON object empty array seems to be the same object in script

Open
#2,354 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Description

JSON object empty array seems to be the same object in script, if you allocate a new array and push some objects, all the other empty array push the same objects

Steps to Reproduce

  1. response is JSON like
{
    "a": [],
    "b": { "bb": [] },
    "c": "c"
}
  1. In script allocate a new array and push some objects like
repsonse.body.d = [];
response.body.d.push({key: 'value'});

Current Behavior

new response is like

{
    "a": [ { "key": "value" } ],
    "b": { "bb": [ { "key": "value" } ],
    "c": "c",
    "d": [ { "key": "value" } ]
}

Expected Behavior

{
    "a": [],
    "b": { "bb": [] },
    "c": "c",
    "d": [ { "key": "value" } ]
}

Environment

  • App version: Proxyman 5.19.0
  • macOS version: macOS Sequoia 15.3.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the JSON response and script in the issue, focusing on response.body array assignment and push operations. Trace the response-body scripting implementation to determine why empty arrays share inserted objects. Done means only d contains the pushed object while a and b.bb remain empty, with a regression test for nested empty arrays.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
desktop, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.