Support line in tests
Replace index by line
Fix invalid JSON