JSON serializable khoom yog dab tsi?
JSON serializable khoom yog dab tsi?

Video: JSON serializable khoom yog dab tsi?

Video: JSON serializable khoom yog dab tsi?
Video: Flutter Json Serializable & Build Runner Tutorial | Flutter Package 2024, Kaum ib hlis
Anonim

Lub sij hawm JSON - serializable khoom siv nyob rau hauv no specification txhais tau tias ib khoom uas tuaj yeem serialized rau ib txoj hlua siv JSON . stringify thiab tom qab ntawd deserialized rov qab mus rau ib qho khoom siv JSON . parse nrog tsis poob ntawm cov ntaub ntawv.

Raws li txoj cai, JSON serializable yog dab tsi?

JSON yog hom ntawv uas encodes cov khoom hauv ib txoj hlua. Serialization txhais tau tias hloov ib yam khoom rau hauv txoj hlua ntawd, thiab deserialization yog nws cov haujlwm inverse (hloov hlua -> khoom). Serialization tuaj yeem hloov cov khoom siv no rau hauv cov hlua byte rau kev siv.

Ib yam li ntawd, qhov khoom serialization hauv python yog dab tsi? Yam khoom Taw qhia Python - Object Serialization . Kev tshaj tawm. Hauv cov ntsiab lus ntawm kev khaws cov ntaub ntawv, serialization yog tus txheej txheem ntawm kev txhais cov ntaub ntawv qauv los yog khoom xeev rau hauv hom ntawv uas tuaj yeem khaws cia (piv txwv li, hauv cov ntaub ntawv lossis lub cim xeeb tsis muaj) lossis kis tau thiab rov tsim dua tom qab.

Kuj kom paub, nws txhais li cas rau serialize ib yam khoom?

Serialization yog tus txheej txheem ntawm converting ib khoom nyob rau hauv ib tug kwj ntawm bytes khaws cov khoom los yog xa mus rau lub cim xeeb, database, lossis ib cov ntaub ntawv. Nws lub hom phiaj tseem ceeb yog los cawm lub xeev ntawm ib qho khoom thiaj li yuav rov tsim tau nws thaum xav tau. Cov txheej txheem rov qab yog hu ua deserialization.

Dab tsi yog JSON khoom hauv Python?

Taw qhia ntawm JSON hauv Python : Daim ntawv puv ntawm JSON yog JavaScript Yam khoom Lus cim. Nws txhais tau hais tias ib tsab ntawv (executable) cov ntaub ntawv uas yog ua los ntawm cov ntawv nyeem hauv cov lus programming, yog siv los khaws thiab hloov cov ntaub ntawv. Python txhawb nqa JSON los ntawm ib lub pob built-in hu ua json.

Pom zoo: