Skip to content

Support JSON inputs too #12

Description

@simonw

I find myself wanting to generate commit messages for JSON files.

This can reuse almost all of the logic from csv-diff - so for the moment I'm going to add that ability here rather than spin up a brand new tool.

A rename if this tool can come later!

Activity

  1. simonw commented on Feb 23, 2021

    @simonw
    OwnerAuthor

    Annoyingly the --json flag is already being used for "output as JSON".

  2. simonw commented on Feb 23, 2021

    @simonw
    OwnerAuthor

    I can use --format=json instead (already has --format=csv and --format=tsv).

  3. simonw commented on Feb 23, 2021

    @simonw
    OwnerAuthor

    Had to add special treatment for nested lists and objects - they get serialized to a JSON string and compared that way.

    Example output:

    % csv-diff locations.json locations-updated.json --format json --key id       
    3 rows changed
    
      id: rec00SICtL8KJiLim
        Appointment scheduling instructions: "["https://www.riteaid.com/pharmacy/covid-qualifier"]" => "["https://www.riteaid.com/pharmacy/covid-qualifier", "blah 2"]"
    
      id: rec05xrPZ4b7dCDns
        Location Type: "Pharmacy" => "Pharmacy 2"
    
      id: rec0IOCI2WsksvXef
        Name: "WALMART PHARMACY 10-3477" => "WALMART PHARMACY 10-347"
    
  4. added a commit that references this issue on Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions