-
Notifications
You must be signed in to change notification settings - Fork 11
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
Unmarshal giving parse error on valid JSON #12
Comments
Can you reproduce on play.golang.org with some payload? Seems like the input may be corrupted but its hard to tell without a standalone example |
@andeke07 you are 100% correct. Here's a playground link reproducing the issue.
I think it should be resolved, but I wonder what will be the best approach. Changing this behavior at this point will be a breaking change so the default behavior should remain the same. At least until we release a new major version. @andeke07 @tmm1 how would you feel about adding an additional option to determine whether the resulting map should aim to be schema-consistent, or contain all data? |
Actually, I have an even better solution but let's merge the fix for now and open a new issue to discuss over there 🙏 |
fixed in v1.1.1 |
I am trying to use this package for a server which will take JSON input and fire off an alert to our monitoring system. I have a fairly simple JSON package:
Within the eventInfo object, I will have an indeterminate number of fields depending on how much info the alert will be providing (hence why I found this package, I am considering everything within "eventInfo" to be "extra metadata" to add to the alert but I won't necessarily know what that info will be when the event is submitted.
I have the following code:
I am submitting a payload to my server with Insomnia however Marshmallow is giving me an error:
Could not unmarshal incoming data from localhost: parse error: syntax error near offset 156 of ': "stuff"...'
I'm not entirely sure why this is happening. I realise that "more": "stuff" is not part of the struct but I was under the impression that would just be ignored when writing it in to the struct, and these values would then be available in the resultant map that also gets produced.
Is this a bug, or am I formatting my JSON incorrectly and/or handling it incorrectly?
Thanks.
The text was updated successfully, but these errors were encountered: