Reworked ErrorDict.as_json() to prevent unnecessary serialization/deseri...

...alization step.

Thanks @apollo13 for the suggestion. Refs #17413.