Exchange formats: JSON, XML, CSV, YAML

The formats used to exchange data between programs: serialisation, the six JSON types, XML elements and attributes, CSV, YAML; reading a parser error message and picking the right format.

  • 25 cards
  • 5 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. Scenarios
  5. Understand

A few cards from the deck

  • Serialisation: what is it?

    Show the answer

    Turning a program's object into text or bytes that can be stored or sent to another program.

    An object in memory only makes sense inside its program. json.dumps({'a': 1}) produces the text {"a": 1}, which any language can read back.

  • JSON.parse stops with Expected double-quoted property name in JSON at position 25. What is the fix?

    ```json
    {"nom": "Léa", "age": 20,}
    `

    • Remove the comma after 20
    • Replace every double quote with a single quote
    • Put 20 between quotes
    • Add null after the comma
    Show the answer

    Remove the comma after 20

    JSON forbids a trailing comma: after a comma, the parser expects a double-quoted key, hence the message. Position 25 is the closing brace.

  • JSON has six value types: string, number, boolean, …, object and ….

    Show the answer

    JSON has six value types: string, number, boolean, null, object and array.

    It has no date type, no comment and no undefined. A date is sent as a string, by convention in ISO 8601 format.

  • Deserialisation: what is it?

    Show the answer

    Rebuilding the program's objects from text or bytes received or read from a file.

    It fails if the text is malformed, and says nothing about the content when it succeeds: a missing field or one of another type only shows up when you check it.

  • One application writes a date in a JSON message; the other side receives text and cannot interpret it. Which fix is the most robust?

    • Switch to a native JSON date type
    • Write the date as a number with no other convention
    • Agree on an ISO 8601 string, such as "2026-11-06"
    • Send the date as day, month and year in three comma-separated fields
    Show the answer

    Agree on an ISO 8601 string, such as "2026-11-06"

    JSON has no date type: a shared convention is needed. ISO 8601 always uses the same order, sorts like text and can be read in every language.