This project adheres to Semantic Versioning.
The structure and content of this file follows Keep a Changelog.
- The
Expr.Walk()
function was added. Similar to jp.Walk but walk expression matches.
- Fixed reflection map key matches when keys are string derivitives.
- Added the
jp.PathMatch
function that compares a normalized JSONPath with a target JSONPath. - Added
jp.MatchHandler
a TokenHandler that can be used to build a path and data while processing a JSON document. - Added
oj.Match
andsen.Match
functions.
- New script functions can now be added with
jp.RegisterUnaryFunction()
andjp.RegisterBinaryFunction()
.
- Added the missing support of Keyed and Indexed in jp.Modify.
- Added support for C style comment /* */ in the SEN parser.
- Comments are the start of a SEN document now parses without error.
- Makefiles
- Fixed regexp parsing to allow regexp escape sequences.
- Evaluation of a not group such as
!(@.x == 2)
is now correct.
- Reworked the jp equation parser to eliminate some parsing issues.
- Fixed wildcards in filters so that if any value is true a match is
returned. As an example, a path of
a[?(@.b[*].c == 2)].b[0]
might match multiple values ofc
in arrayb
. If any of the values is 2 then it is considered a match.
- Fixed script parsing when padded with spaces.
- Fixed script parsing for negation without parenthesis.
- Added the Expr function
BracketString
to force the use of bracket notation to for normalized paths as described by the draft IETF JSONPath document in section 2.7. - Added
jp.Expr.Locate()
function that returns normalized paths for JSONPath expression.
- Unmarshal now supports arrays such as
[4]int
.
- Added an option to jp.Walk to just callback on leaves making the function more useable.
- A script of
@.x
is now read correctly as@.x exists true
.
- Calling jp.Set on a map or struct with a nil value no longer panics if nil is a valid value for the element being set.
- Added ojg.Options.FloatFormat to allow float output format to be specified.
- A single quote character can now be escaped in strings when using SEN for parsing.
- Descent on a struct for get and first fixed.
- Updated cmd/oj version and updated notes to reference the brew formula.
- asm cond condition is now evaluated correctly.
- The test tool (tt) package Panic() function should return the recovered panic and now does.
- Pooled parsers now reset the number conversion method.
- Added NumConvMethod to convert json.Number to either float64 or a string on parse and recompose.
- Fixed alt.Diff to not skip non-matching map entries.
- Thanks to @thiagodpf allowing JSONPath get on structs to use JSON annotation.
- alt.Diff now handles slice indexes correctly.
- JSONPath with a child selector containing
'
is not escaped properly.
- A comma after a number at the top level now errors out as expected.
- Strings in bracketed JSONPaths with escaped characters are now handled correctly.
- Added support for the Keyed and Indexed interface in the JSONPath (jp) evaluations.
- Fixed "has" and "exists" issue where comparisons were broken with the introduction of
Nothing
.
- Added support for root fragments in filters such as
$.data[?(@.id == $.key)]
. - "exists" is now an alias for the "has" filter operation.
- Added length, count, match, and search functions.
- Added
Nothing
as a value for comparison to return values where nothing is found. - Added support no parenthesis around a filter so
[[email protected] == 3]
is now valid. alt.String()
now converts[]byte
.
- Fix order of union with when final elements are not an
[]any
.
- Added alt.Filter, a variation on alt.Match.
- Added the OmitEmpty option to oj, sen, pretty, and alt packages.
- Added the -o option for omit nil and empty to the oj command.
- Fixed (preserve) order of JSONPath wildcard reflect elements.
- Fixed (preserve) order of JSONPath filtered elements.
- Fixed big number parsing.
- Fixed the descent fragment use in the Modify() functions of the jp package.
- Modify() functions added to the jp package.
- Added the
has
operator to the jp package scripts.
- Remove() functions added to the jp package.
- jp.Set() operations now allow a union as the last fragment in an expression.
- Added
jp.Script.Inspect()
to be able to get the details of a script. - The parser callback function now allows
func(any)
in addition tofunc(any) bool
.
- alt.Builder Pop fixed for nested objects.
- Private members that match a JSON element no longer cause a panic.
- Returned
[]byte
from oj.Marshal and pretty.Marshal now copy the internal buffer instead of just returing it.
- Added SameType test tool.
- Removed dependency on external packages.
- Added the JSONPath filter operation
in
. - Added the JSONPath filter operation
empty
. - Added the JSONPath filter operation
=~
for regex.
- Fixed a case where a un-terminated JSON did not return an error.
- Added jp.Expr.Has() function.
- Added jp.Walk to walk data and provide a the path and value for each element.
[]byte
are encoded according to the ojg.Options.
- For JSONPath (jp) reflection Get returns
has
value correctly for zero field values.
- JSONPath scripts (jp.Script or [?(@.foo == 123)]) is now thread safe.
- Parser reuse was no resetting callback and channels. It does now.
- Added a delete option to the oj application.
- Stuttering extracted elements when using the
-x
options has been fixed.
- Correct unicode character is now included in error messages.
- Typo in maxEnd for 32 bit architecture fixed.
- json.Unmarshaler fields in a struct correctly unmarshal.
-
Due to limitation (a bug most likely) in the stardard math package math.MaxInt64 can not be used on 32 bit architectures. Changes were made to work around this limitation.
-
Embedded (Anonymous) pointers types now encode correctly.
- Support for json.Unmarshaler interface added.
- Updated to use go 1.17.
- Setting an element in an array that does not exist now creates the array is the Nth value is not negative.
- Error message on failed recompose was fixed to display the correct error message.
- Marshal of a non-pointer that contains a json.Marshaller that is not a pointer no longer fails.
- Structs with recursive lists no longer fail.
- Applying filters to a non-simple list such as
[]*Sample
now supported as expected.
- SEN format parsing now allows string to be delimited with the single quote character.
- SEN format parsing now allows strings to be concatenated with syntax like
["abc" + "def"]
. - SEN format parsing now allows functions such as
ISODate("2021-06-28T10:11:12Z")
in SEN data.
- When Pretty Align is true map members are now aligned.
- Missing support for json.Marshaler and encoding.TextMarshaler added.
- Struct with pointers to base types such as *float64 are fixed.
- Stack overflow when converting values to JSON which are a type alias of a builtin.
- Added
[]byte
converation option for decompose. - Added MustXxx versions of multiple functions to allow a panic and recover code pattern.
- oj.Unmarshal now emits float64 for all numbers instead of int64 for integers. The parse functions remain unchanged.
- Multiple part json tags are now parsed correctly and the string options is supported in both decompose and compose.
- Tokenize callback parser added.
- OmitNil now catches nil maps and slices more consistently.
- Number parsing in the form of 2e-7 has been fixed.
- Writer functions now decompose structs if possible instead of resorting to %v too quickly.
- When parsing SEN format
\r
is now allowed in strings to support Windows line termination as it works in Linux and macOS.
- oj.Unmarshal now supports the optional alt.Recomposer as documented.
- Recomposer handles time.Time recomposing like any other struct.
- Write writes time.Time to conform to other struct encoding.
- The Recomposer is now more flexibly in regard to input types. It now allows json.Unmarshal() targets as well as the type create key approach.
- Added flag to alt.Options to determine whether embedded anonymous types whould be output as nested elements or flattened.
- Added oj.Unmarshal and sen.Unmarshal.
- Added alignment option for pretty printing.
- Added alt.Diff() and alt.Compare().
- Added color option for encoded time.
- Add alt.Converter along with some built in converter for time and mongodb export maps.
- Added HTMLUnsafe option to oj JSON writing to not encode &, <, and > to provide consistency
- Added HTMLSafe option to sen options to encode &, <, and > to provide consistency
- Fixed panic for
{"""":0}
. Now an error is returned.
- Added support for a configuration file.
- Added ability to set colors when using the -c and -b option.
- Added ability to set HTML colors when using the -html option.
- Added assembly plan package and cmd/oj option that allows assembling a new JSON from parsed data.
- Added sen.Parse() and sen.ParseReader() that use a new sen.DefaultParser
- Added the pretty package for prettier JSON layout.
- Added HTMLOptions for generating HTML color styled text.
- Fixed reflection bug that occurred when a struct did not have the requested field.
- Added tab option for indentation.
- Write operations now use panic and recovery internally for more robust error handling and for a very slight performance improvement.
- The SEN parser and writer did not allow
\n
or\t
in strings. It now does as would be expected from a friendly format.
- JSONPath Slice end is now exclusive as called for in the Goessner description and the consensus.
- Nested array parsing bug fixed.
- oj.Marshal added. The function fails if an un-encodeable value is encountered.
- UseTags option added for write and decompose Options.
- Order is preserved when using JSONPath to follow wildcards, unions, and slices.
- Parse Resuse option added to allow reusing maps on subsequent parses.
- In addition to callbacks, parsing multi-json documents can place elements on a
chan interface{}
.
- A code refactoring resulting in a performance boost to Parsing and Validation.
- Validation speedup using a one switch statement and character maps.
- Validator bug introduced in the speedup fixed.
- Performance improvement on validation and parsing.
- Write bug that incorrectly wrote some UTF-8 sequences.
- Simple Encoding Notation
- Lazy input and out options to the
cmd/oj
command.
- Filters will now iterate over Object members as well as Array members.
cmd/oj
now correctly allows JSON as an argument in addition to reading from a file.
- Initial release.