Skip to main content

parse_json_array

Function parse_json_array 

Source
pub fn parse_json_array(text: &str) -> Result<OmmArray, OmmError>
Expand description

Parse a CelesTrak OMM JSON array into every contained Omm.

CelesTrak GP queries return a JSON array of OMM objects; this reads all of them (a lone object is accepted as a one-element array) through the same field mapping parse_json uses. An individual array element that is not a valid OMM object is skipped and counted in OmmArray::skipped rather than aborting the whole array. A malformed top-level document (not valid JSON, or neither an object nor an array) is still an error. Requires the json feature.