JSon Encoding does not work

Each time I use json_encode it corrupts arrays on reading (i.e _decode). I have tested serialization and works fine without illegal offset that comes with json_decode