Fix bad object-state modifying bug

Also re-work JSON support some, assume JS for now.