• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Issue with APIEvent / JSON

Runningcore

Well-Known Member
Contributor
Hello,

i finally updated my sinusbot installation from 0.14 to 1.0.0.

As some of my scripts are using APIEvents i now encounter issues with JSON interpretation.

Example:
If i send the following json:
JSON:
{
    "somedata": [
        12345,
        54321,
        9875312
    ]
}

The bot get me this:
JSON:
{
    "somedata": [
        {},
        {},
        {}
    ]
}

If i send the following json, it works as expected:
JSON:
{
    "somedata": {
        "1": 123,
        "2": 456
    }
}

This upper is just an simple example, my real scenario is a array full of objects with an unknown length but it behaves the same way.
Do I misunderstood something or need adjust my formatting/input?

Thank you!
 
It's a bug that currently exists in the engine.log() only. It'll print {} for integers. Will be fixed in the next version.
So you should actually be able to use those arrays as expected.
 
So you should actually be able to use those arrays as expected.
I can't.

It'll print {} for integers
Okay, but this shouldn't apply to objects?

Example:
JSON:
{
    "somedata": [
        {attr1: 'SomeText', attr2: 123},
        {...},
        {...}
    ]
}

Gets me this and also the iteration part is reporting null values/non existing attributes:
JSON:
{
    "somedata": [
        {},
        {},
        {}
    ]
}
 
Can you test with console.log instead? Check if it gets printed any way better
 
Back
Top Bottom