refactored JSON parsing in Rede

I know this is a big pull request, but most of the changed lines are indentation changes. I thought that its better to do one big pull request, because Rede is already public. I tried to structure of the refactoring steps with the commits.