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

Deserializing failes with header wichi has underscore for its name #10

Open
kimsama opened this issue Mar 26, 2013 · 2 comments
Open

Deserializing failes with header wichi has underscore for its name #10

kimsama opened this issue Mar 26, 2013 · 2 comments

Comments

@kimsama
Copy link

kimsama commented Mar 26, 2013

Recently, I've cloned GDataDB from github and import it to Unity3D which is based on Mono.

It works fine except one.

The problem is that a property which has '_' for its name didn't work properly as it is expected.

See the following as an example:

public class MissionData
{
public int id { get; set; }
public string key { get; set; }
public string screen_name { get; set; }
public string enemy_keys { get; set; }
public int cost_energy { get; set; }
public int rewardxp { get; set; }
public int reward_money { get; set; }
public string reward_package_key { get; set; }
}

The class MissionData has several properties which has '_' for its name as 'screen_name'.

Then tried to retrieved data from the google spreadsheet as the sample code:

var client = new DatabaseClient(username, password);
var db = client.GetDatabase(testSheetName);
var table = db.GetTable(tableName);
var all = table.FindAll();
...

The value of the properties 'id' and 'key' are collect what it's value on the spreadsheet but 'screen_name' has nothing.

So I removed all '_' from properties name and then it works.

The problem was that Serializer.Deserialize(in Serializer.cs) does not retrieve correct property if the property has underscore within its name.

Is that known issue or any way to fix that problem?

@kimsama
Copy link
Author

kimsama commented Mar 26, 2013

After hanging on googling, found the below:

https://groups.google.com/forum/embed/?place=forum%2Fgoogle-spreadsheets-api&showsearch=true#!searchin/google-spreadsheets-api/underscore/google-spreadsheets-api/kwPoMl_V0SM/F9w0t16zV-AJ

It seems to be that there are some header naming rules but not clear what exactly it is.

@mausch
Copy link
Owner

mausch commented Mar 26, 2013

Yes, it seems to be an issue with the gdata API. I found:

https://productforums.google.com/d/msg/docs/gM5l95M1tQo/HaY_ghSImwIJ
http://stackoverflow.com/questions/7108001/google-spreadsheets-api-removes-underscore

It seems that switching from list feed to cell feed works around this problem. This would require some non-trivial refactorings in GDataDB.

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

2 participants