-
Notifications
You must be signed in to change notification settings - Fork 74
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
Use schema #56
Comments
+1 |
2 similar comments
+1 |
👍 |
This issue is a massive head ache especially when you are dealling with a response that has many associations that may be a single result or mutliple results. This means you either have to write a response formattter to correct this or use inflections some how. 😢 |
@andrew-whitmore, I ended up using this excellent XSLT for converting XML to JSON: https://github.com/bramstein/xsltjson You could choose an XML conversion convention, depending on your needs and how convoluted your XML is. In my case, I'm dealing with really convoluted XML, so I ended up using the really verbose rayfish conversion convention but at least it always produces uniform results: arrays for everything. You'll need a good XSLT 2.0 compliant library for that purpose though: I couldn't find a suitable one in Ruby, so I ended up using the saxon9 Java library in production. So yeah, a bit complicated solution but it works pretty well for me. |
Suppose we have the following XML:
Nori will create the following hash:
If we have the following document schema:
element
['root']['a'][0]['b']
should return a single-valued array, but there is no way to specify this to Nori.The text was updated successfully, but these errors were encountered: