-
Notifications
You must be signed in to change notification settings - Fork 137
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
XML serialization / format output for serialize :attribute, Hash #149
Comments
You can use the It works like hash :stats |
Didn't make any difference for XML. But I do have complex hashes and hashes with arrays. I'm going to try implementing a separate representer for XML, thou I was mostly just playing with it - to see if I could get XML out of this setup for free. I don't need to support it now - JSON is what I need for API. I might need to expose XML interface down the line if we try more integrations with legacy systems. |
I am pretty sure there's hash support out-of-the-box with Representable, my internet is terribly slow currently but I can try to find an example for you. |
@apotonick If you ever found an example it would be very helpful to see it. I was unable to and the Update: I actually did get this to work, but now I have an additional question. Here is an example of what it looks like when I use <filters>
<provider>
{"npi"=>"689", "tin"=>"155", "address"=>[{"street"=>["11 Main St"], "city"=>"NewTown", "state"=>"MO", "zip"=>"12345", "country"=>"us"}]}
</provider>
</filters> |
Hi
I have a model Product with a bunch of serialized attributes - like so. This is a to keep some information that's calculated and updated once a week usually for reporting - and I don't do any searches on this data - it's essentially a free form dump field for stats.
Anyways when I render this as JSON - it's fine, cause hashes are first-class citizens. They are essentially Javascript objects ( for my purposes.)
However see what's happening to the same data when requested as xml. Any ideas what to do here?
What's the proper way to render this as XML?
The text was updated successfully, but these errors were encountered: