Skip to content

that will compare two json objects and give a score between 0 and 1 as to how similar they are, a score of 1 meaning the objects are identical.

License

Notifications You must be signed in to change notification settings

1akshat/json-similarity

Repository files navigation

JSON Object Similarity Score

Website https://json-similarity.herokuapp.com/ made with rails BuiltBy made with javascript BuiltBy MIT license

This Repo aims at calculating the similarity score of two valid json objects. The Score varies from 0 to 1.0 being non-similar and 1 being fully identical.


How Scoring Algorithm Works?

  • The overall program expects two json objects as an input.
  • Each and Every key/value pairs of both the json inputs are compared to one another. The logic is to traverse through one of the Hash and finding the same key value in the other Hash. Cases:

    • If the key/value is present in both
      • Their is an equality check and on the basis of that equality global counters for truthy and falsy values are increamented.
    • If key/value is missing in one
      • In this case the key/value for the missing one is set as empty hash {} and then the same check is done as former.
  • It traverse through the complete json and then finally Counters are captured for truthy and falsy values.

  • Finally, Score is Calculated using: Truthy / Truthy + Falsy

NOTE: The score value is returned from range 0 - 1 .0being completely non-identical and1` being completely identical.


Steps to Run the project locally:

* Clone the repo: https://github.com/1akshat/json-similarity.git
* Navigate to the respective directory:
    cd json-similarity/
* Install all the dependencies.
    Run: bundle install
* Start The Server.
    RUN: rails s
* Visit: http://localhost:3000

Preview

alt text

Website Link

https://json-similarity.herokuapp.com/

About

that will compare two json objects and give a score between 0 and 1 as to how similar they are, a score of 1 meaning the objects are identical.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages