Fix str2dict and dict2str's incorrect behavior

Closes-bug: #1258065

Change-Id: Idf14c077eeeda6f18f534ad8f62cd741d0c0a2eb
Merge "Fix str2dict and dict2str's incorrect behavior"