Browse Source

changes in json validation service class

master
yoganandhank 1 year ago
parent
commit
957709a862
  1. 8
      src/main/java/com/gcc/crslogs/service/BirthAndDeathDetailsService.java

8
src/main/java/com/gcc/crslogs/service/BirthAndDeathDetailsService.java

@ -1,7 +1,8 @@
package com.gcc.crslogs.service;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@ -125,7 +126,10 @@ public class BirthAndDeathDetailsService {
.replaceAll("\t", "") // Remove tab characters explicitly (common cause of error)
.replaceAll("\\s*:\\s*\n\\s*\"", ":\"") // Fix broken key-value splits
.replaceAll("\r", "") // Remove carriage return if any
.replaceAll("\n", ""); // Optionally remove newlines if JSON is malformed across lines
.replaceAll("\n", "") // Optionally remove newlines if JSON is malformed across lines
.replaceAll(",\\s*\\[", "[") // Remove comma before array start
.replaceAll("\\[\\s*,", "[") // Remove comma after array start
.replaceAll(",\\s*\\]", "]"); // Remove trailing comma in array
}

Loading…
Cancel
Save