Skip to main content

Inspect json data and fuzzy search for values or key names

Project description

Fuzzy matching for JSON payload. Find json_path that matches best for your provided value

Install

$ pip install jsfuzz

Examples:

{
  "id": 11,
  "title": "perfume Oil",
  "description": "Mega Discount, Impression of A...",
  "price": 13,
  "discountPercentage": 8.4,
  "rating": 4.26,
  "stock": 65,
  "brand": "Impression of Acqua Di Gio",
  "category": "fragrances",
  "thumbnail": "https://i.dummyjson.com/data/products/11/thumbnail.jpg",
  "images": [
    "https://i.dummyjson.com/data/products/11/1.jpg",
    "https://i.dummyjson.com/data/products/11/2.jpg",
    "https://i.dummyjson.com/data/products/11/3.jpg",
    "https://i.dummyjson.com/data/products/11/thumbnail.jpg"
  ]
}
from jsfuzz import inspector

# Default top_k=5 json paths will be returned
result = inspector.search(payload, "brand")

pprint(result)
====================

Returns:

[('$.brand', 'Impression of Acqua Di Gio', 75.80645161290323),
 ('$.rating', '4.26', 38.18181818181817),
 ('$.category', 'fragrances', 22.769230769230766),
 ('$.thumbnail',
  'https://i.dummyjson.com/data/products/11/thumbnail.jpg',
  22.033898305084744),
 ('$.description', 'Mega Discount, Impression of A...', 20.657894736842106)]
result = inspector.search(payload, "65", top_k=10)

pprint(result)
====================

Returns:

[('$.stock', '65', 30.0),
 ('$.rating', '4.26', 20.0),
 ('$.thumbnail', 'https://i.dummyjson.com/data/products/11/thumbnail.jpg', 0.0),
 ('$.category', 'fragrances', 0.0),
 ('$.brand', 'Impression of Acqua Di Gio', 0.0),
 ('$.discountPercentage', '8.4', 0.0),
 ('$.price', '13', 0.0),
 ('$.description', 'Mega Discount, Impression of A...', 0.0),
 ('$.title', 'perfume Oil', 0.0),
 ('$.id', '11', 0.0)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsfuzz-0.1.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsfuzz-0.1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file jsfuzz-0.1.1.tar.gz.

File metadata

  • Download URL: jsfuzz-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for jsfuzz-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cc5d87faecf01535e3a79f32d4c8c8d8f80de5391f5412131579364a88bc8963
MD5 cd0547786f36b907c8029c2a2173f65b
BLAKE2b-256 d5478e689868688bb07818207a678d65b907026cbf4e7c9a598d9f2b4b021791

See more details on using hashes here.

File details

Details for the file jsfuzz-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: jsfuzz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for jsfuzz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1cea499ea62d3ba737050a8a439e1c22eaaadec9b4234d03fe2b08e5500f6c80
MD5 3368d30bb887fd3359d68a19b4e51d6b
BLAKE2b-256 0a7f6ce549d446e463103762ebed1349aacdc2d161b9dcd86a4e27c601e0e297

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page