Refactored Node::renderJSON function to properly format children.

Corrected logic in controller that was preventing queries from working.