Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When written with keepWsc: true, carries comments #56

Open
lastuniverse opened this issue Jun 29, 2021 · 0 comments
Open

When written with keepWsc: true, carries comments #56

lastuniverse opened this issue Jun 29, 2021 · 0 comments

Comments

@lastuniverse
Copy link

raw hjson string

var text = '{\
    "last.access": true,\
    // "last.set": true,\
    // "skills.use": true,\
    // "last.wrap.*": true,\
}';

parse it and then base it back into text

var data = HJSON.parse(text, {keepWsc: true});
text = HJSON.stringify(data, {
    keepWsc: true,
    bracesSameLine: true,
    quotes: 'all',
    separator: true,
    space: '\t',
});

as a result, we get the following string

'{\
    "last.access": true    // "last.set": true,\
    // "skills.use": true,\
    // "last.wrap.*": true,\
}';

repeating these steps several times teaching such a line

'{\
    "last.access": true    // "last.set": true,    // "skills.use": true,    // "last.wrap.*": true,\
}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant