binary serializer for predefined JSON structures optimized for small output