tests/testthat/_snaps/json.md

can roundtrip ptype through JSON

Code
  cereal_to_json(df$a)
Error <rlang_error>
  `data` must be a data frame, not the number 1.
Code
  json
Output
  {
    "a": {
      "type": "numeric",
      "example": "1",
      "details": []
    },
    "b": {
      "type": "integer",
      "example": "2",
      "details": []
    },
    "c": {
      "type": "Date",
      "example": "2023-01-01",
      "details": []
    },
    "d": {
      "type": "POSIXct",
      "example": "2019-01-01",
      "details": {
        "tzone": "America/New_York"
      }
    },
    "e": {
      "type": "character",
      "example": "x",
      "details": []
    },
    "f": {
      "type": "factor",
      "example": "blue",
      "details": {
        "levels": ["blue", "green", "red"]
      }
    },
    "g": {
      "type": "ordered",
      "example": "small",
      "details": {
        "levels": ["small", "medium", "large"]
      }
    }
  }


Try the cereal package in your browser

Any scripts or data that you put into this service are public.

cereal documentation built on July 9, 2023, 6:59 p.m.