c# - Controller's action with dictionary as parameter stripping to dot -


i have action receives class dictionary in properties:

public actionresult testaction(testclass testclass) {     return view(); }  public class testclass {     public dictionary<string, string> keyvalues { get; set; } } 

if post action following json:

{   "keyvalues": {     "test.withdot": "testwithdot"   } } 

the key in dictionary stripped dot , has nothing in value.

enter image description here

trying without dot works. how can post dot in dictionary<string, string> mvc?

we gave blind try supposing there regex parser somewhere in deep (well minimal chance) , escape 'dot'.

after thinking while concluded: dot not legal char in identifiers. yes know key in c# dictionary, in json part (and javascript) in identifier syntax role.

so suggest replace client side . (dot) escape sequence _dot_ , replace in server side. performance suffer of course.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -