Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TypeError: the JSON object must be str, bytes or bytearray, not OrderedDict #115

Open
noraj opened this issue Jul 8, 2024 · 1 comment

Comments

@noraj
Copy link

noraj commented Jul 8, 2024

I'm using last release 2.2.7.

It seems to be a similar error as in #21 that was fixed in v1.3.5. However, it seems exactly the same issue as in #106

So there is maybe another json.loads that should be changed in json.dumps.

While decoding a token:

Token payload values:
…
[+] prop_a = JSON object:
    [+] aaa = "['stuff_a', 'stuff_b', 'stuff_c', 'stuff_d']"
[+] prop_b = JSON object:
Traceback (most recent call last):
  File "/usr/share/jwt-tool/jwt_tool.py", line 2103, in <module>
    rejigToken(headDict, paylDict, sig)
  File "/usr/share/jwt-tool/jwt_tool.py", line 1299, in rejigToken
    comparestamps, expiredtoken = dissectPayl(paylDict)
                                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/jwt-tool/jwt_tool.py", line 1203, in dissectPayl
    if type(castInput(paylDict[claim][subclaim])) == str:
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/jwt-tool/jwt_tool.py", line 595, in castInput
    jsonInput = json.loads(newInput)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not OrderedDict

The data:

  
  "prop_a": {
    "aaa": [
      "stuff_a",
      "stuff_b",
      "stuff_c",
      "stuff_d"
    ]
  },
  "prop_b": {
    "bbb": {
      "ccc": [
        "stuff_e",
        "stuff_f",
        "stuff_g"
      ]
    }
  },
  
@noraj
Copy link
Author

noraj commented Jul 8, 2024

It seems #114 and #111 are trying to fix OrderedDict casting issues.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant