New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write a script to turn DataClass into JSON #71
Comments
I've forgotten the full history of I'm not really sure if that's better or not than having it in Python. I've also forgotten how we generated it. I'm pretty sure it was just a python |
This is purely for inter-language operability 😅 I'm working on a project in Go and can't use the DB here unless it's in a text-file based format (such as JSON) I feel like this app is 2 parts:
If we can export to JSON, it means other languages can use it and that means we can get more contributors. I was playing around with the idea of having the database be a Git submodule, but I don't see why a JSON export wouldn't work for what I'm imagining :) |
Hi bee, here you go: import json
return_value = []
for prototype in prototypes:
return_value.append(
{
"regex": str(prototype.regex.pattern),
"modes": [asdict(i) for i in prototype.modes],
}
)
with open("result.txt", "w") as file:
file.write(json.dumps(return_value, indent=4)) add this to the end of the hashes.py and run it. Ill put the json attached |
Thank you!!! |
What do you mean by this? I can't see it |
Ah wait that's the regex itself nvm |
Ahh no worries 😄 |
Turn all the
DataClass
's in this file:https://github.com/HashPals/Name-That-Hash/blob/main/name_that_hash/hashes.py
Into JSON with this format:
https://github.com/psypanda/hashID/blob/master/prototypes.json
Please submit a PR to the repo with your script :)
The text was updated successfully, but these errors were encountered: