Fix converting of fields to json