-
Notifications
You must be signed in to change notification settings - Fork 97
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
More lenient unmarshal type rules #3
Comments
Huh, interesting. You ought to be able to make do with interface{} for the type in question, but I realize that's non-ideal. Internally, we support the concept of lax decoding - maybe it's useful to enable us to "lax-decode" an int as a float64? |
(also, thank you!) |
Thinking about this more, it makes sense to allow consumers to provide their own plist unmarshaling functions. I'm mulling over a core rewrite (right now, we have an intermediate format to and from which objects are marshaled/unmarshaled before they're flattened out to disk; i'd like to end that :P) that might allow me to integrate something like that. |
The changes in 221fc98 should address this somewhat; you can use a custom unmarshal type. |
I'm playing with using this package to unmarshal plist files output by the Day One app. They are a bit quirky in that the data types in their plist file change depending on the data. So for example, in one file a value might be
<integer>
but in another<real>
.I tried to handle this by making my struct fields
float64
thinking that the less specificinteger
should unmarshal into this just fine. Alas, it did not.I'd rather not fall back to unmarshalling this as generic XML. Any chance there is a workaround or some change that could be made to your package to support this scenario? Open to any recommendations you have.
The text was updated successfully, but these errors were encountered: