Skip to content

Conversation

@ANAMASGARD
Copy link
Contributor

@ANAMASGARD ANAMASGARD commented Jan 10, 2026

Problem

RJSONIO is no longer maintained on CRAN (issue #193). We need to migrate to jsonlite, which is the modern standard used by Shiny, plotly, and other major R packages.

FIXES:#193

Solution

Commit 1: Validation Tests (Current)

  • Added 44 tests validating jsonlite can handle all animint2 data structures
  • Tests confirm auto_unbox=TRUE produces correct JSON format
  • All validation tests pass
  • Added jsonlite to Suggests in DESCRIPTION

Commit 2: Migration (Coming Next)

  • Will replace all RJSONIO calls with jsonlite
  • Will use parameters: auto_unbox=TRUE, dataframe="rows", null="null"
  • All existing tests should continue passing

Testing

Screenshot From 2026-01-10 13-25-37

Add comprehensive validation tests for jsonlite compatibility before
migrating from RJSONIO. These tests verify jsonlite with auto_unbox=TRUE
can handle all animint2 data structures.

Tests validate:
- Single value encoding without array wrapping
- Vector arrays preservation
- Nested geom structures (plot.json format)
- Layout data with boolean arrays
- Axis, grid, selector, and panel data
- Complete export.data round-trip
- Valid JSON output for JavaScript parsing
- Numeric precision preservation

All 44 validation tests pass, confirming jsonlite is ready for migration.
Actual code migration will follow in next commit.

Also adds jsonlite to Suggests in DESCRIPTION for testing.

Part of #193 - RJSONIO deprecation migration
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.68%. Comparing base (68b074e) to head (533b4a8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
+ Coverage   73.06%   77.68%   +4.62%     
==========================================
  Files         164      164              
  Lines        8758     8758              
  Branches        0      554     +554     
==========================================
+ Hits         6399     6804     +405     
+ Misses       2359     1954     -405     
Flag Coverage Δ
javascript 95.46% <ø> (+14.70%) ⬆️
r 69.53% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ANAMASGARD
Copy link
Contributor Author

Screenshot From 2026-01-10 15-24-06
  • Locally all the test have passed .
  • Migrated to jsonlite without any error .

Replace RJSONIO with jsonlite in DESCRIPTION, NAMESPACE, and all code.
Use auto_unbox=TRUE and force=TRUE for toJSON, simplifyVector=FALSE for fromJSON.
All tests pass. Closes #193
@ANAMASGARD ANAMASGARD force-pushed the migrate-rjsonio-to-jsonlite branch from 02a11ef to e2b41bd Compare January 10, 2026 13:55
@tdhock
Copy link
Collaborator

tdhock commented Jan 10, 2026

No obvious timing issues in HEAD=migrate-rjsonio-to-jsonlite
Comparison Plot

Generated via commit bbcc1e7

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 2 minutes and 28 seconds
Installing different package versions 15 seconds
Running and plotting the test cases 2 minutes and 25 seconds

also converts named numeric and integer vectors to JSON objects.
This was causing 349 test failures in JS_coverage and R_coverage.
Without this parameter, jsonlite outputs {} instead of null for NULL values.
This was causing JavaScript errors when checking for null values in plot.json
fields like span.rowspan and span.colspan, resulting in 350 test failures
in JS_coverage and R_coverage.
@ANAMASGARD ANAMASGARD requested a review from tdhock January 10, 2026 16:22
@ANAMASGARD ANAMASGARD mentioned this pull request Jan 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants