ARJSON successfully handles most JSON transformations. This report focuses on actual bugs and implementation issues that need fixing, excluding non-JSON features like undefined, NaN, Infinity, and circular references which are outside JSON specification.
Issue: Empty objects {} and arrays [] use special 2-byte encoding that doesn't create the reference structure needed for delta updates.
Impact: Cannot use empty structures as starting point for delta updates
Current Workaround: Use minimal structures like {_:null} or [null]
Fix Strategy:
- Option A: When encoding empty structures, check if they might need updates and use standard encoding
- Option B: Handle empty structure as special case in delta system
- Option C: Document as intentional trade-off for size optimization
Issue: Object keys containing brackets are misinterpreted as array indices.
Example:
{ "user[admin]": true } // Breaks: parser thinks "user" is array
{ "data[2020]": 100 } // Breaks: tries to parse "2020" as array indexImpact: Cannot update objects with bracket-containing keys
Fix Strategy:
- Implement proper key escaping/quoting in path parser
- Use different syntax for array access (e.g.,
/separator) - Or document as limitation and validate keys during encoding
Issue: JavaScript encoder fails with large numbers due to precision and overflow issues.
Problems:
- Numbers approaching MAX_SAFE_INTEGER may lose precision
- Very large numbers cause infinite loops in encoder
- Not language-agnostic
Fix Strategy:
// Detect and handle large numbers appropriately
if (Math.abs(v) > Number.MAX_SAFE_INTEGER) {
// Use BigInt path or throw clear error
throw new Error("Number exceeds safe range")
}
// For floats, detect problematic ranges
if (Math.abs(v) > 1e15) {
// Use alternative encoding or limit precision
}Language-Agnostic Approach:
- Define clear number ranges in spec
- Let each language handle within its capabilities
- Specify behavior for out-of-range numbers
Issue: Very deep nesting (50+ levels) causes performance degradation or stack issues.
Impact: Practical limit of ~20-30 nesting levels
Fix Strategy:
- Convert recursive algorithms to iterative
- Add configurable depth limit with clear error
- Optimize stack usage in parser
- undefined: Correctly not supported (not valid JSON)
- NaN/Infinity: Correctly converted to null (JSON standard)
- Circular references: Correctly rejected (not valid JSON)
- Sparse arrays: Correctly densified (JSON has no sparse arrays)
These are not bugs - they follow JSON specification correctly.
- Keys with brackets - Path parser fix
- Large numbers - Prevent infinite loops, add range checking
- Empty structure deltas - Either fix or document clearly
- Deep nesting - Iterative algorithms
- Float precision - Document precision limits
- Performance - Optimize hot paths
- Better error messages - Clear feedback for unsupported operations
- Validation - Warn about problematic keys early
- Test coverage - Edge case testing
// Current (broken)
parsePath("user[admin]") // Incorrectly parsed as array access
// Proposed
parsePath("user['admin']") // Quoted keys
parsePath("user\[admin\]") // Escaped brackets
parsePath("user.[admin]") // Different syntaxfunction validateNumber(n) {
if (!Number.isFinite(n)) {
return null; // JSON standard
}
if (Math.abs(n) > MAX_SAFE_ENCODING) {
throw new RangeError(`Number ${n} exceeds safe encoding range`);
}
return n;
}// Option: Add metadata flag
if (isEmpty(obj) && needsDeltaSupport) {
encoder.useStandardEncoding();
} else {
encoder.useCompactEncoding();
}- All valid JSON structures
- Keys with special characters (dots, brackets, quotes)
- Number boundary values within safe ranges
- Deep nesting up to reasonable limits
- Empty to non-empty transformations
- Large objects (1000+ keys)
- Circular references
- undefined values
- Numbers beyond safe range
- Invalid UTF-8 in strings
- All valid JSON can be encoded, decoded, and delta-updated
- No crashes or hangs on any input
- Clear error messages for unsupported features
- Predictable performance characteristics
- Cross-language compatibility for valid JSON
ARJSON's core design is solid. The main issues are:
- Path parser bug with bracket-containing keys
- JavaScript number handling causing infinite loops
- Empty structure delta limitation
These are fixable implementation bugs, not fundamental design flaws. Once fixed, ARJSON will robustly handle all valid JSON transformations.