json generation improved