Created
May 29, 2012 21:09
-
-
Save JonasGroeger/2830728 to your computer and use it in GitHub Desktop.
How to print the field name and value of an arbitrary object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void logObjectAsJSON(String tag, Object o) { | |
// In order for this to work you need the XStream library located at http://xstream.codehaus.org/ | |
XStream x = new XStream(new Sun14ReflectionProvider(new FieldDictionary(new ImmutableFieldKeySorter())), new JsonHierarchicalStreamDriver()); | |
Log.d(tag, x.toXML(o)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment