File tree Expand file tree Collapse file tree
main/java/org/andrejs/json
test/java/org/andrejs/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ public int hashCode() {
7373
7474 @ SuppressWarnings ("unchecked" )
7575 public <T > T get (String key ) {
76- return (T ) map .get (key );
76+ return (T ) toMap () .get (key );
7777 }
7878
7979 @ SuppressWarnings ({ "unchecked" , "rawtypes" })
@@ -146,8 +146,10 @@ public Json copy() {
146146
147147 /** Read declared field values using reflection **/
148148 Map <String , Object > readFields () {
149- Map <String , Object > fieldVals = new LinkedHashMap <String , Object >();
149+ Map <String , Object > fieldVals = new LinkedHashMap <>();
150150 for (Field f : getClass ().getDeclaredFields ()) {
151+ if (f .getName ().contains ("$" ))
152+ continue ;
151153 Object val = JsonSerializer .getFieldValue (f , this );
152154 if ( val != null && !isStatic (f .getModifiers ()) )
153155 fieldVals .put ( f .getName () , val );
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ public void containsAnonymousClassFields() throws Exception {
4343 String key2 = "val" ;
4444 };
4545 int val = json .get ("key" );
46+ System .out .println (json );
4647 assertEquals (123 , val );
4748 assertEquals ("val" , json .get ("key2" ));
4849 }
You can’t perform that action at this time.
0 commit comments