-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cJSON_strcasecmp:converted to lower case for comparison #13
Comments
Don’t you feel like you might be tempting fate with two nodes with the same name but different case? Is that terrific data design? But hey, if you want to go that route, I won’t stop you! Have the following three routines and forget about case insensitivity forever! But unless I’ve misread the JSON spec, I won't be adding them to HEAD any time soon. cJSON *cJSON_GetObjectItemCASE(cJSON *object,const char *string) {cJSON *c=object?object->child:0;while (c && strcmp(c->string,string)) c=c->next; return c;} cJSON *cJSON_DetachItemFromObjectCASE(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && strcmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;} void cJSON_ReplaceItemInObjectCASE(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && strcmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
|
Thanks. But aaaaa(this is lower case) and AAAAA(this is upper case),they are different strings. |
Closed. |
Sorry! I read it, but i did not understand. Now i understand. |
@DaveGamble: Where does the JSON Spec say that object names are case insensitive? As far as I can see it only specifies that it has to be a valid JSON string: http://rfc7159.net/rfc7159#rfc.section.4 |
Presumably I misread the JSON spec then. However, I seem to remember there being some discussion about this on the JSON mailing list. Changing to case sensitivity MIGHT break a lot of code. Or none at all?! How would we know? |
Ok, let's make a legacy release. Let's say 0.0.0, of the current master (after resolving issue #26). That would contain cJSON as it is, only security fixes will be applied. People who are concerned about compatibility with broken JSON can then use that for the time being. And then we can break all we want in the 1.0.0 release. |
Fixed on the |
Why is converted to lower case for comparison?
Cause xxxxx and XXXXX two nodes can not be normal access。
The text was updated successfully, but these errors were encountered: