Dev json xff v0.4

New version based on previous PR #1111.
Interesting, maybe there is some missing include as this is the same as in the original version.