Skip to content

Releases: falkreon/Jankson

2.0.0-alpha.2

31 May 10:31
b823c46
Compare
Choose a tag to compare
2.0.0-alpha.2 Pre-release
Pre-release

This is a multi-thousand-line change from Alpha 1. This is not an exhaustive list of changes.

  • API is now symmetric between StructuredDataReaders and StructuredDataWriters
  • New StructuredData record represents atoms in the data-stream processed by readers and writers.
  • New StructuredDataPipe is both a reader and a writer, operating as a buffer or FIFO queue.
  • Greatly fleshed out writer API, including the ability to set arbitrary indent strings
  • New transferTo() method on readers makes it easy to pipe data from readers into writers
  • New optional projections from ObjectElement and ArrayElement to help some flatMap cases
  • Fixed a bug where trailing root comments were not preserved
  • JsonReader can now accept any type of Json data including bare primtiives, thanks to the addition of a RootParserContext

Known issues:

  • Comments are not read out of @Comment annotations by ObjectStructuredDataReader
  • ObjectStructuredDataWriter is not yet implemented

In general, plain java objects, and especially records, still need some attention before the main 2.0 release.

Feedback Sought

If possible I'd like people to examine and use the following:

  • The new StructuredData record
  • the newly-symmetric StructuredDataReader and Writer APIs
  • piping data between readers and writers with transferTo()

With a more mature JsonReader, I'd also like people to look for any json character data that won't parse as expected. If you find anything, please make an Issue! Without an Issue I'll forget!

1.2.3

23 Jul 02:24
59a4a3d
Compare
Choose a tag to compare

More bugfixes!

  • Fixed #75 where collections that were populated by a constructor were retaining their default contents when being loaded from json, creating increasing numbers of duplicates in save-load cycles.

1.2.2

15 Mar 15:50
d85faf1
Compare
Choose a tag to compare

This is a bugfix release. There are no API changes.

  • Fixed annotated Deserializer methods not being recognized.
  • Fixed a parser error caused by trailing whitespace.
  • Fixed a parser error caused by hexadecimal constants containing capital letters or leading zeroes.

2.0.0-alpha.1

24 Feb 22:34
f218529
Compare
Choose a tag to compare
2.0.0-alpha.1 Pre-release
Pre-release

It lives!

This is an alpha, and is missing a LOT of functionality and important quirks!

  • No bare roots
  • No unquoted keys
  • In fact most reader options are just ignored right now
  • Yes optional commas (my BNF is just weird that way)
  • Barbaric but probably functional serialization
  • No automatic packing/unpacking of POJOs

So what can you do?

ValueElement configElement = Jankson.readJson("{ 'network': { 'timeout': 1200 } }");
if (configElement instanceof ObjectElement config) {
    long timeout = config
      .getObject("network")
      .getPrimitive("timeout")
      .asLong()
      .orElse(DEFAULT_TIMEOUT);
}

The API is very different and the more feedback I can get at this stage, the easier it will be to steer the project into a more useful place for everyone. That said I'm very happy with the result, and I think the "hello world" experience is greatly improved.

There are a lot of tests that need to be ported to the new system and I've started that work too. We've gone from 90 down to fewer than 40, but those tests are important and they'll come back soon.

Anyway this is a test! Put in issues or contact me on discord if there are bugs or we need to make some tweaks. By the time we're done I'm hoping the new design will be able to squash some long-standing Issues from 1.2.x too.

1.2.1

25 May 12:07
14fa24c
Compare
Choose a tag to compare

This will be the last major Java 8 release, as we look forward to LTS Java. It includes several bugfixes:

  • Multiple comments attributed to one key-value pair will be folded into a multi-line comment instead of being discarded
  • Better charset support; cyrillic characters are now handled properly
  • Correct indent after comments when printing out bare root objects

There are other things which happened, like BigDecimal support and Serializer/Deserializer annotations, which don't cleanly fit into one release or another, but are finished now.

Json5 Support and Deserializer Improvements

16 Jan 21:54
3eca068
Compare
Choose a tag to compare

Fully compliant with JSON5

I think the JSON5 informative example says it best:

{
  // comments
  unquoted: 'and you can quote me on that',
  singleQuotes: 'I can use "double quotes" here',
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  positiveSign: +1,
  trailingComma: 'in objects', andIn: ['arrays',],
  "backwardsCompatible": "with JSON",
}

JSON5 offers a number of extremely helpful, user-focused constructions, and describes a BNF that's shockingly close to how Jankson is already structured. Both parsing and serialization were given the small tweaks they needed to bring them into line, and compliance has been added to the test suite to make sure we keep this promise going forward: Jankson does JSON5.

Advanced deserialization

In its 1.0 release, Jankson's deserializer - the part that turns a JsonObject into a plain java object of your design - lagged pretty significantly behind other json frameworks, requiring for instance Jankson and Gson to be used together. Jankson still supports this usage pattern going forward, but the deserializer has received some important upgrades:

  • All JavaSE-provided collections should deserialize correctly.
  • Jankson can now unpack most nested custom types without a type adapter
  • Most generics - as long as they're not type parameters of the top-level object you pass to fromJson - are recovered at runtime and used to make better choices about what objects to create and how to unpack them.

Some limitations still remain:

  • Nested generics like List<List<T>> still fail to unpack. Future support is planned, but if you need this behavior right now, it's reccommended to use the Jankson+Gson pattern.

Public Release

12 Dec 17:26
c68f077
Compare
Choose a tag to compare

Patched up maven logic and pinned for release. This binary should be identical to the 'blue.endless:jankson:1.0.0-7' maven publication.