Skip to content

Commit

Permalink
Reduce scope (remove ndjson/geonjson) to expedite preparation for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbutuseless committed Jan 5, 2024
1 parent 7360c78 commit 7abe56b
Show file tree
Hide file tree
Showing 84 changed files with 370 additions and 6,523 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: yyjsonr
Type: Package
Title: Fast JSON, GeoJSON and NDJSON Parsing and Serialisation
Version: 0.1.12
Title: Fast JSON Parsing and Serialisation
Version: 0.1.13
Authors@R: c(
person("Mike", "FC", role = c("aut", "cre"), email = "[email protected]"),
person("Yao", "Yuan", role = "cph", email = "[email protected]",
Expand Down
9 changes: 0 additions & 9 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
# Generated by roxygen2: do not edit by hand

export(opts_read_geojson)
export(opts_read_json)
export(opts_write_geojson)
export(opts_write_json)
export(read_flag)
export(read_geojson_file)
export(read_geojson_str)
export(read_json_conn)
export(read_json_file)
export(read_json_raw)
export(read_json_str)
export(read_ndjson_file)
export(validate_json_file)
export(validate_json_str)
export(write_flag)
export(write_geojson_file)
export(write_geojson_str)
export(write_json_file)
export(write_json_str)
export(write_ndjson_file)
export(write_ndjson_str)
useDynLib(yyjsonr, .registration=TRUE)
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@


# yyjsonr 0.1.13 2024-01-05

* Remove NDJSON and GeoJSON code to simplify preparation for CRAN. Will
re-introduce this code in future releases.
* Updated to YYJSON v0.8.0

# yyjsonr 0.1.12 2023-10-29

* Fix an off-by-one error when reporting line numbers in NDJSON handling.
Expand Down
131 changes: 0 additions & 131 deletions R/geojson.R

This file was deleted.

114 changes: 0 additions & 114 deletions R/ndjson.R

This file was deleted.

63 changes: 18 additions & 45 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,11 @@ if (FALSE) {
[![R-CMD-check](https://github.com/coolbutuseless/yyjsonr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coolbutuseless/yyjsonr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

`{yyjsonr}` is a fast JSON parser/serializer, which converts R data to/from JSON, GeoJSON and NDJSON.
`{yyjsonr}` is a fast JSON parser/serializer, which converts R data to/from JSON.

In most cases it is around 2x to 10x faster than `{jsonlite}` at both reading and writing JSON.

It is based around the [`yyjson`](https://github.com/ibireme/yyjson) C library.

### Help needed!

If you have an interest in fast JSON reading/writing in R, then **I need your help**.

The scope of this package and options it supports are still in flux. What
can I add to help your JSON needs? Open an issue on github and let me know!

You can assist by:

* Finding cases that give unexpected results for your JSON needs
* Suggesting how you want to have a particular JSON object to appear in R
* Propose configuration options to control a particular aspect of how *you*
want JSON to translate to/from R
* Trying it out in your package as an alternative to your current JSON package.
* Is it worth the change?
* What functionality is lacking?
* What would you need to make the switch proper?
* Suggesting additional interesting benchmarks/tests.
* Creating/Donating a nice hex logo!
It is a wrapper for the [`yyjson`](https://github.com/ibireme/yyjson) C library.


### The `yyjson` C library
Expand All @@ -78,23 +58,17 @@ library (version `YYJSON_VERSION_HEX = 0x000700`).
| json | read | read_json_str() | read_json_file() | read_json_raw() | read_json_conn() | opts_read_json() |
| | write | write_json_str() | write_json_file() | | | opts_write_json() |
| | validate | validate_json_str() | validate_json_file() | | | |
| geojson | read | read_geojson_str() | read_geojson_file() | | | opts_read_geojson() |
| | write | write_geojson_str() | write_geojson_file() | | | opts_write_geojson() |
| ndjson | read | | read_ndjson_file() | | | |
| | write | write_ndjson_str() | write_ndjson_file() | | | |



### Comparison to other JSON packages

| | Write JSON| Read JSON | READ ndjson | Write ndjson | R/W geojson `{sf}`|
|--------------|-----------|-----------|-------------|--------------|-------------------|
| yyjsonr | Fast! | Fast! | Fast! | Fast! | Fast! |
| jsonlite | Yes | Yes | Yes | Yes | |
| RcppSimdJson | | Fast! | | | |
| jsonify | Yes | Yes | Yes | Yes | |
| ndjson | | | Yes | Yes | |
| geojsonsf | | | | | Yes |
| | Write JSON| Read JSON |
|--------------|-----------|-----------|
| yyjsonr | Fast! | Fast! |
| jsonlite | Yes | Yes |
| RcppSimdJson | | Fast! |
| jsonify | Yes | Yes |


<img src="man/figures/benchmark-summary.png">
Expand Down Expand Up @@ -135,13 +109,13 @@ Parsing differences compared to `{jsonlite}`
In `{yyjsonr}` the order in which elements in an array are serialized to
JSON correspond to an array of row-major matrices in human-readable order.

`{jsonlite}` does things differently. The array formats are internally
`{jsonlite}` does things differently.

The array formats are internally
consistent within each package, but not cross-compatible between them i.e.
you cannot serialize an array in `{yyjsonr}` and re-create it exactly
using `{jsonlite}`.

The matrix handling in `{yyjsonr}` is compatible with the expectations of GeoJSON
coordinate handling.

```{r}
# A simple 3D array
Expand Down Expand Up @@ -169,15 +143,14 @@ yyjsonr::read_json_str(str)
```


## Future









* Re-introduce NDJSON support
* NDJSON support was removed for the initial CRAN release for the sake of my sanity.
* See the `ndjson` branch of this repository
* Re-introduce GeoJSON support
* GeoJSON support was removed for the initial CRAN release for the sake of my sanity.
* See the `geojson` branch of this repository

## Limitiations

Expand Down
Loading

0 comments on commit 7abe56b

Please sign in to comment.