Skip to content
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

unhappy to convert json lists #34

Open
muelli opened this issue Feb 22, 2018 · 0 comments
Open

unhappy to convert json lists #34

muelli opened this issue Feb 22, 2018 · 0 comments

Comments

@muelli
Copy link

muelli commented Feb 22, 2018

it seems to be unhappy to transform my nested structure containing a list:

➜ json-to-elm git:(master) ✗>python generate.py form.json 
Generating type alias, decoders and encoders from form.json
Traceback (most recent call last):
  File "generate.py", line 131, in <module>
    main()
  File "generate.py", line 127, in main
    print_everything(f.read(), name)
  File "generate.py", line 55, in print_everything
    aliases = create_type_alias(stuff, type_alias_name=alias_name)
  File "/home/muelli/vcs/json-to-elm/type_alias.py", line 49, in create_type_alias
    for name, value in stuff.items():
AttributeError: 'list' object has no attribute 'items'
➜ json-to-elm git:(master) ✗>

The structure looks like this:

[
    {
        "id": 1,
        "name": "form1",
        "form": {
            "tabs": [
                {
                    "id": 1,
                    "name": "some topic",
                    "fields": [
                        {
                            "key": "02",
                            "name": "q1",
                            "description": "foo?",
                            "is_required": true,
                            "default_value": null,
                            "state": "active"
                        }
                    ]
                }
            ]
        }
    }
]

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

No branches or pull requests

1 participant