feat(smartjson): Add JSONL stringify and ordering comparator; fix empty buffer handling; refactor Smartjson folding/enfolding

This commit is contained in:
2025-09-12 19:30:15 +00:00
parent 58322d23f4
commit fe8b5ce7c0
6 changed files with 78 additions and 30 deletions

View File

@@ -99,6 +99,13 @@ const jsonLines = `{"event":"start","time":1234}
const events = smartjson.parseJsonL(jsonLines);
// Result: Array of parsed objects
// Produce JSONL from objects
const jsonlOut = smartjson.stringifyJsonL([
{ event: 'start', time: 1234 },
{ event: 'data', value: 42 },
{ event: 'end', time: 5678 }
]);
// Compare JSON Lines data
const jsonL1 = `{"id":1}\n{"id":2}`;
const jsonL2 = `{"id":1}\n{"id":2}`;
@@ -308,6 +315,7 @@ class AppConfig extends Smartjson {
- `stringifyBase64(obj: any): string` - Encode JSON as base64
- `parseBase64(base64String: string): any` - Decode base64 JSON
- `parseJsonL(jsonLinesString: string): any[]` - Parse JSON Lines format
- `stringifyJsonL(items: any[]): string` - Stringify array to JSON Lines
- `deepEqualObjects(obj1: any, obj2: any): boolean` - Deep comparison of objects
- `deepEqualJsonLStrings(jsonL1: string, jsonL2: string): boolean` - Compare JSON Lines strings
@@ -365,4 +373,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.