JS 객체를 데이터베이스에 저장할 계획이지만 탐색기와 같은 객체는 JSON.stringify (객체)를 사용할 때 "Uncaught RangeError : Maximum call stack size exceeded"를 반환합니다.JSON Large JS Object에 직렬화
탐색기 개체 (정리하지 않고)와 같이 JSON 대형 자바 스크립트 개체를 직렬화하는 방법은 무엇입니까?
JS 객체를 데이터베이스에 저장할 계획이지만 탐색기와 같은 객체는 JSON.stringify (객체)를 사용할 때 "Uncaught RangeError : Maximum call stack size exceeded"를 반환합니다.JSON Large JS Object에 직렬화
탐색기 개체 (정리하지 않고)와 같이 JSON 대형 자바 스크립트 개체를 직렬화하는 방법은 무엇입니까?
JSON.stringify에 거의 사용되지 않는 두 번째 매개 변수를 사용하여 JSON에 안전 "중단"을 적용 할 수 있습니다. 이 네비게이터는 충분한 공간이 결코 이유를 확인하는 데 도움이 :
var used=[];
var str=JSON.stringify(navigator, function(a,b,c){
if(used.indexOf(b)===-1 && used.length < 100){
used.push(b);
return b;
}
});
alert(str);
//shows: {"geolocation":{},"webkitPersistentStorage":{},"webkitTemporaryStorage":{},"onLine":true,"vendorSub":"","vendor":"Google Inc.","productSub":"20030107","product":"Gecko","mimeTypes":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{"0":{"enabledPlugin":{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
방금 100 담당자 후 포인트를 얻을 수 있지만 ... IF 만이 할 수있는 모든 밤 내가 내기 갈 수있는 게터가 있음 각 호출마다 새로운 객체를 방출하므로 동일한 객체를 두 번 보지 못합니다.
100에서 5000으로 변경하면 크롬이 깨지지만 새로운 특성은 나타나지 않습니다.
데이터가 거대하고 db에 삽입해야하는 경우 데이터를 더 작은 청크로 가져 오는 추가 하위 엔터티 및 그룹화로 확실히 정규화 할 수 있어야합니다. 그런 다음 데이터 그룹을 반복하여 json으로 변환하고 저장하면 도움이 될 수 있습니다.
이것은 대답도 아니고 논리적 인 생각도 아닙니다. –
백엔드 및 프런트 엔드 코드를 제공해주십시오. 올바른 코드 언어도 포함하십시오. 감사! – abc123
MongoDB와 같은 문서 기반 DB를 사용하고 데이터 구조가 어떻게 재검토되는지 고려하십시오. – Brad
네비게이터의 크기가 문제가 아니며 스스로를 참조 할 수있는 무한 루프가 있습니다. – dandavis