Skip to content

toJSON incorrectly stringifies object #1073

Open
@Grafu

Description

@Grafu

Describe the bug

When serializing a standalone object, the returned JSON puts it into an array. This is incorrect because the object is not in an array before serialization. An argument for correct behavior should solve the problem.

To reproduce

srun outputChatBox(toJSON ( { "dogs", cat = "hungry", mouse = "food", birds = 4 } ))

Expected behaviour

Command results: { "1": "dogs", "mouse": "food", "cat": "hungry", "birds": 4 } [string]

Actual behaviour

Command results: [ { "1": "dogs", "mouse": "food", "cat": "hungry", "birds": 4 } ] [string]

This should only be triggered by:
toJSON ( { { "dogs", cat = "hungry", mouse = "food", birds = 4 } } )

Version

MTA:SA Server v1.5.6-release-16345
Multi Theft Auto v1.5.6-release-18706

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions