Skip to content

Option to keep tuples on the same line #100

Closed
@adrientetar

Description

@adrientetar

I'm using rapidjson (great package, thank you!) to dump contents to a json file, and I use indent=0 to get a readable/diffable file.

However I have many tuples in my files, such as transformation matrices, and (though JSON has no tuple type) it would be nice to have them all on the same line instead of broken down, which makes the file harder tor ead and larger.

So basically:

[{"matrix": (1, 0, 0, 1, 181, 0)}, {"matrix": (1, 0, 0, 1, 0, 0)}]

would become:

[
{
"matrix": [1, 0, 0, 1, 181, 0]
},
{
"matrix": [1, 0, 0, 1, 181, 0]
}
]

instead of:

[
{
"matrix": [
1,
0,
0,
1,
181,
0
]
},
{
"matrix": [
1,
0,
0,
1,
181,
0
]
}
]

because tuples wouldn't get flattened.

Does that sound reasonable / is it feasible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions