system_out_제거

This commit is contained in:
cho
2026-03-03 14:09:55 +09:00
parent dfcec99576
commit 8b72299689
42 changed files with 173 additions and 172 deletions
@@ -104,22 +104,22 @@ public class JsonPathUtil {
public static void main(String[] args) {
String jsonString = "{ \"person\": { \"name\": \"John\", \"age\": 30, \"groups\": [ { \"id\": 1, \"name\": \"Group A\" }, { \"id\": 2, \"name\": \"Group B\" }, { \"id\": 3, \"name\": \"Group C\" } ] } }";
System.out.println("Source JSON: \n" + jsonString);
// System.out.println("Source JSON: \n" + jsonString);
// 경로를 사용하여 값 가져오기 (반복되는 그룹 포함)
String getPath = "/person/groups/1/name";
String secondGroupName = getValueAtPath(jsonString, getPath);
System.out.println("getPath: " + getPath + " -> " + secondGroupName);
// System.out.println("getPath: " + getPath + " -> " + secondGroupName);
// 경로를 사용하여 값 설정하기 (반복되는 그룹 포함) 및 Pretty 출력
String putPath = "/person/groups/2/name";
String updatedJsonString = setValueAtPath(jsonString, putPath, "Group Z", true);
System.out.println("putPath: " + putPath);
System.out.println("Updated JSON (Pretty): \n" + updatedJsonString);
// System.out.println("putPath: " + putPath);
// System.out.println("Updated JSON (Pretty): \n" + updatedJsonString);
getPath = "/person/name";
System.out.println("getPath: " + getPath + " -> " + getValueAtPath(jsonString, getPath));
// System.out.println("getPath: " + getPath + " -> " + getValueAtPath(jsonString, getPath));
getPath = "/person/age";
System.out.println("getPath: " + getPath + " -> " + getValueAtPath(jsonString, getPath));
// System.out.println("getPath: " + getPath + " -> " + getValueAtPath(jsonString, getPath));
}
}