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

Cannot deserialize attributes that are camelCased #166

Closed
blade83 opened this issue Aug 17, 2012 · 3 comments
Closed

Cannot deserialize attributes that are camelCased #166

blade83 opened this issue Aug 17, 2012 · 3 comments

Comments

@blade83
Copy link

blade83 commented Aug 17, 2012

-- UPDATE

It seems that any variable that is camelCased is not deserialised.

-- Original post
Scenario:
Json to be deserialized:
{
"critId" : "hello"
}

PHP class:

class Crit
{
/** @type("string") */
$critId;
}


There are no errors thrown during the above deserialisation. However, the attribute critId in Crit is null. When the name of critId is changed to something without the Id suffix, it works.

This is the first time I'm reporting a bug, so please let me know if I've missed something.

Thanks

@stephpy
Copy link

stephpy commented Sep 6, 2012

<?php

class Crit
{
/** 
* @SerializedName("critId")
* @type("string")
*/
protected $critId;
}

Or look at:

property_naming:
        separator:  _
        lower_case: true

@stephpy
Copy link

stephpy commented Sep 6, 2012

or you have to pass to json something like that

{ 'crit_id': ..... }

@schmittjoh
Copy link
Owner

Please ask usage questions on the mailing list. Thanks.

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

3 participants