{"id":13527,"date":"2022-06-30T11:49:17","date_gmt":"2022-06-30T18:49:17","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=13527"},"modified":"2025-06-13T21:24:56","modified_gmt":"2025-06-14T04:24:56","slug":"validate-json-python-couchbase-capella","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-python-couchbase-capella\/","title":{"rendered":"Uso do Pydantic para validar documentos JSON com o Couchbase\u00a0"},"content":{"rendered":"<p><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/products\/capella\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Capella<\/span><\/a><span style=\"font-weight: 400\"> \u00e9 uma oferta de DBaaS (Database-as-a-Service) de documento JSON totalmente gerenciado que elimina as tarefas de gerenciamento de banco de dados e reduz os custos gerais.<\/span><span style=\"font-weight: 400\"> A Capella oferece <\/span><span style=\"font-weight: 400\">desempenho robusto, flexibilidade e escalabilidade em um banco de dados distribu\u00eddo e nativo da nuvem moderna que combina os pontos fortes dos recursos de bancos de dados relacionais, como transa\u00e7\u00f5es SQL e ACID, com a flexibilidade e a escala JSON que definem o NoSQL.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><a href=\"https:\/\/pydantic-docs.helpmanual.io\/\" target=\"_blank\" rel=\"noopener\">Pydantic<\/a> \u00e9 uma biblioteca que permite que os desenvolvedores definam e validem objetos JSON personalizados usando anota\u00e7\u00f5es de tipo Python. O Pydantic acelera o tempo de codifica\u00e7\u00e3o, aplicando dicas de tipo em tempo de execu\u00e7\u00e3o e gerando erros de valida\u00e7\u00e3o f\u00e1ceis de usar. Os documentos JSON gerados com o pydantic podem ser usados na plataforma Capella sem a preocupa\u00e7\u00e3o com documentos mal formados que podem ocorrer quando os documentos JSON s\u00e3o criados por meio da concatena\u00e7\u00e3o padr\u00e3o de strings.<\/span><\/p>\n<h2>Configura\u00e7\u00e3o do pydantic<\/h2>\n<p><b>Para executar o projeto de in\u00edcio r\u00e1pido, voc\u00ea precisa dos seguintes pr\u00e9-requisitos:<\/b><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">URL do reposit\u00f3rio Git:<\/span><a href=\"https:\/\/github.com\/brickj\/capella_pydantic\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400\">https:\/\/github.com\/brickj\/capella_pydantic<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Python 3 instalado<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">O <\/span><a href=\"https:\/\/pypi.python.org\/pypi\/pip\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">tubula\u00e7\u00e3o<\/span><\/a><span style=\"font-weight: 400\"> ferramenta de gerenciamento de pacotes<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Instalado o Couchbase Capella\u2122 SDK:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A documenta\u00e7\u00e3o completa est\u00e1 localizada <\/span><a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/hello-world\/start-using-sdk.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">aqui<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Exemplo de comando Python<\/span><span style=\"font-weight: 400\">: <\/span><em><span style=\"font-weight: 400\">pip install couchbase<\/span><\/em><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Instalada a biblioteca Python pydantic:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A documenta\u00e7\u00e3o completa est\u00e1 localizada <\/span><a href=\"https:\/\/pydantic-docs.helpmanual.io\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">aqui<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Exemplo de comando Python<\/span><span style=\"font-weight: 400\">: <\/span><em><span style=\"font-weight: 400\">pip install pydantic<\/span><\/em><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Conta do Couchbase Capella:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Inscreva-se em um <\/span><a href=\"https:\/\/cloud.couchbase.com\/sign-up?utm_source=google&amp;utm_medium=search&amp;utm_campaign=GGL+-+North+America+-+US%2FCA+-+Cloud+-+Brand&amp;utm_keyword=couchbase%20capella&amp;kpid=go_cmp-14963773353_adg-137104722708_ad-553533476354_kwd-1437680311919_dev-c_ext-_prd-&amp;gclid=Cj0KCQjw1N2TBhCOARIsAGVHQc6Hhim-rIoBroo4P8mV14fFqMggiU53KLMYW8dSFuUj9Ypvo_L9GRYaAvKqEALw_wcB\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">teste gratuito de 30 dias<\/span><\/a><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Nome do cluster e do bucket do Couchbase Capella <em>pydantic<\/em><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">Neste blog, examinarei rapidamente um exemplo de uso do pydantic para criar documentos JSON v\u00e1lidos e armazen\u00e1-los no Couchbase Capella.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">O Couchbase Python SDK permite que os desenvolvedores executem opera\u00e7\u00f5es CRUD em um bucket especificado em um cluster do Couchbase. Por exemplo, o trecho de c\u00f3digo a seguir executa um upsert (inserir se a chave do documento n\u00e3o estiver no bucket ou atualizar se o documento j\u00e1 existir):\u00a0<\/span><\/p>\n<pre class=\"decode-attributes:false lang:python decode:true\"># Store a Document\r\ncb_coll.upsert('u:king_arthur', {'name': 'Arthur', 'email': 'kingarthur@couchbase.com', 'interests': ['Holy Grail', 'African Swallows']})<\/pre>\n<p><span style=\"font-weight: 400\">Os desenvolvedores Python geralmente criam documentos JSON usando strings ou inteiros para preencher um objeto de dicion\u00e1rio que armazena pares de valores-chave. Esse objeto de dicion\u00e1rio \u00e9 ent\u00e3o enviado para o compartimento especificado no banco de dados do Capella para inser\u00e7\u00e3o. O c\u00f3digo de amostra para criar e preencher o objeto de dicion\u00e1rio \u00e9 semelhante ao trecho abaixo:<\/span><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<pre class=\"decode-attributes:false lang:python decode:true\"># Dictionary object with keys and values\r\nsample_dict = {1: 'document 1', 2: 'document 2'}<\/pre>\n<p><span style=\"font-weight: 400\">Com o pydantic, os desenvolvedores t\u00eam a flexibilidade de especificar um esquema para objetos JSON que pode ser aplicado \u00e0 medida que os documentos s\u00e3o criados. Por exemplo, as etapas a seguir mostram a cria\u00e7\u00e3o de um documento JSON para publica\u00e7\u00f5es de usu\u00e1rios. O modelo do documento tem a seguinte apar\u00eancia:<\/span><\/p>\n<p><span style=\"font-weight: 400\"> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-13528\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/07\/couchbase-pydantic-data-model-1024x597.png\" alt=\"Data model for pydantic tutorial with Couchbase\" width=\"900\" height=\"525\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/07\/couchbase-pydantic-data-model-1024x597.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/07\/couchbase-pydantic-data-model-300x175.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/07\/couchbase-pydantic-data-model-768x447.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/07\/couchbase-pydantic-data-model-20x12.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/07\/couchbase-pydantic-data-model.png 1236w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400\">Cada <em>UserPost<\/em> tem os campos usados na postagem, mas cada postagem pode ter v\u00e1rias revis\u00f5es que precisam ser aninhadas dentro da postagem. Para habilitar essa funcionalidade, os desenvolvedores podem criar duas classes separadas para o objeto <em>UserPost<\/em> e o <em>Revis\u00e3o<\/em>. Por exemplo:<\/span><\/p>\n<pre class=\"decode-attributes:false lang:python decode:true\">class Review(BaseModel):\r\n\u00a0 author: str\r\n\u00a0 review: str\r\n\u00a0 likes: int\r\n\u00a0\r\nclass UserPost(BaseModel):\r\n\u00a0 author: str\r\n\u00a0 date: str\r\n\u00a0 title: Optional[str] = None\r\n  content: str\r\n  id: int\r\n  likes: List[str]\r\n  reviews: List[Review]<\/pre>\n<h2>Cria\u00e7\u00e3o de documentos JSON em Python<\/h2>\n<p><span style=\"font-weight: 400\">Depois que os objetos s\u00e3o criados, \u00e9 f\u00e1cil preencher os documentos:<\/span><\/p>\n<pre class=\"decode-attributes:false lang:python decode:true\">review = [\r\n\u00a0 Review(author=\"johndoe\", review=\"This is a comment!\", likes=3),\r\n\u00a0 Review(author=\"rickJ\", review=\"This is a Rick J comment!\", likes=1),\r\n\u00a0 Review(author=\"janedoe\", review=\"This is a Jane Doe comment!\", likes=2)\r\n\u00a0 ]\r\n\r\nuser_post1 = UserPost(author=\"johndoe\",\r\n  date=\"1\/1\/1970\",\r\n  title=\"Cool post\",\r\n  content=\"Cool content\",\r\n  id=10101,\r\n  likes=[\"johndoe\", \"janedoe\"],\r\n  reviews=review)\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Agora voc\u00ea pode usar o <em>UserPost<\/em> como um dicion\u00e1rio e inseri-lo no Couchbase Capella usando um c\u00f3digo semelhante ao c\u00f3digo upsert mostrado anteriormente, mas usando o objeto <em>dict()<\/em> m\u00e9todo:<\/span><\/p>\n<pre class=\"decode-attributes:false lang:python decode:true\"># Upsert JSON dict with key 'u:pydantic_document'\r\ncb_coll.upsert('u:pydantic_document', user_post1.dict())<\/pre>\n<p><span style=\"font-weight: 400\">O projeto completo ilustrado neste blog inclui o seguinte:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Leiame com instru\u00e7\u00f5es<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">C\u00f3digo que cria os objetos UserPost e Review<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">C\u00f3digo que gera e imprime um documento na sa\u00edda<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">C\u00f3digo que se conecta ao Couchbase Capella usando o Couchbase Python SDK<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">C\u00f3digo que insere o documento JSON gerado<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">O projeto p\u00fablico pode ser clonado para o Git em: <\/span><a href=\"https:\/\/github.com\/brickj\/capella_pydantic\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">https:\/\/github.com\/brickj\/capella_pydantic<\/span><\/a><\/p>\n<h2><b>Pr\u00f3ximas etapas<\/b><\/h2>\n<p><span style=\"font-weight: 400\">Para saber mais sobre<\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/products\/capella\/\"> <span style=\"font-weight: 400\">Couchbase Capella<\/span><\/a><span style=\"font-weight: 400\">nossa oferta de banco de dados como servi\u00e7o:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Inscreva-se em um\u00a0<\/span><a href=\"https:\/\/cloud.couchbase.com\/?href=Playground\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">teste gratuito de 30 dias<\/span><\/a><span style=\"font-weight: 400\"> se voc\u00ea ainda n\u00e3o o fez<\/span><\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/cloud.couchbase.com\/sign-up\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Conecte seu cluster de teste ao Playground<\/span><\/a><span style=\"font-weight: 400\"> ou conecte um projeto para test\u00e1-lo por si mesmo<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Se voc\u00ea j\u00e1 estiver usando o Couchbase Capella, poder\u00e1 interagir com seu cluster usando o shell interativo do Couchbase ou por meio do plano de controle do Capella para:<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Confira o visualizador de documentos<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Conectar-se a um projeto<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">D\u00ea uma olhada no<\/span> <a href=\"https:\/\/developer.couchbase.com\/learn\/capella\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Caminho de aprendizado Capella<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Confira nossos tutoriais<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">O <\/span><a href=\"https:\/\/developer.couchbase.com\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Portal do desenvolvedor do Couchbase<\/span><\/a><span style=\"font-weight: 400\"> tem toneladas de<\/span> <a href=\"https:\/\/developer.couchbase.com\/tutorials\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">tutoriais\/guias de in\u00edcio r\u00e1pido<\/span><\/a><span style=\"font-weight: 400\"> e <\/span><a href=\"https:\/\/developer.couchbase.com\/learn\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">caminhos de aprendizagem<\/span><\/a><span style=\"font-weight: 400\"> para ajudar voc\u00ea a come\u00e7ar<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/docs.couchbase.com\/home\/sdk.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Consulte a documenta\u00e7\u00e3o<\/span><\/a><span style=\"font-weight: 400\"> para saber mais sobre os SDKs do Couchbase<\/span><\/li>\n<li>Ler <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-documents-in-python-using-pydantic\/\" target=\"_blank\" rel=\"noopener\">Valida\u00e7\u00e3o de documentos JSON em Python usando Pydantic<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">Neste ponto, voc\u00ea deve ser capaz de usar rapidamente a biblioteca pydantic para criar documentos JSON v\u00e1lidos para uso com <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/products\/capella\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">Couchbase Capella<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">Se tiver alguma d\u00favida ou coment\u00e1rio, entre em contato conosco pelo <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/forums\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400\">F\u00f3runs do Couchbase<\/span><\/a><span style=\"font-weight: 400\">!<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Couchbase Capella is a fully managed JSON document Database-as-a-Service (DBaaS) offering that eliminates database-management duties and reduces overall costs. Capella offers robust performance, flexibility and scalability in a modern cloud native, distributed database that fuses the strengths of relational database [&hellip;]<\/p>","protected":false},"author":70772,"featured_media":9965,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2225,9139,2201],"tags":[1261,1725,9687],"ppma_author":[9208],"class_list":["post-13527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-python","category-tools-sdks","tag-json","tag-nosql-database","tag-pydantic"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.7 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Pydantic to Validate JSON Documents With Couchbase\u00a0<\/title>\n<meta name=\"description\" content=\"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here&#039;s how.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-python-couchbase-capella\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Pydantic to Validate JSON Documents With Couchbase\u00a0\" \/>\n<meta property=\"og:description\" content=\"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here&#039;s how.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-python-couchbase-capella\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-30T18:49:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T04:24:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"904\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rick Jacobs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Jacobs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/\"},\"author\":{\"name\":\"Rick Jacobs\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ecb4001e1e4b88a5c44d20c7bf39fcd3\"},\"headline\":\"Using Pydantic to Validate JSON Documents With Couchbase\u00a0\",\"datePublished\":\"2022-06-30T18:49:17+00:00\",\"dateModified\":\"2025-06-14T04:24:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/\"},\"wordCount\":681,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg\",\"keywords\":[\"JSON\",\"NoSQL Database\",\"pydantic\"],\"articleSection\":[\"Couchbase Capella\",\"Python\",\"Tools &amp; SDKs\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/\",\"name\":\"Using Pydantic to Validate JSON Documents With Couchbase\u00a0\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg\",\"datePublished\":\"2022-06-30T18:49:17+00:00\",\"dateModified\":\"2025-06-14T04:24:56+00:00\",\"description\":\"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here's how.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg\",\"width\":1280,\"height\":904,\"caption\":\"Using SDK's With Couchbase Cloud\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Pydantic to Validate JSON Documents With Couchbase\u00a0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ecb4001e1e4b88a5c44d20c7bf39fcd3\",\"name\":\"Rick Jacobs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/398e492dda1c41103d3dfa60dfd80cfe\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4df9d5daa89732e9e520a2ded9e366daf2b32b5aea74313c561073fbc3784be9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4df9d5daa89732e9e520a2ded9e366daf2b32b5aea74313c561073fbc3784be9?s=96&d=mm&r=g\",\"caption\":\"Rick Jacobs\"},\"description\":\"Rick Jacobs is the Technical Product Marketing Manager at Couchbase. His varied background includes experience at many of the world\u2019s leading organizations such as Computer Sciences Corporation, IBM, Cloudera etc. He comes with over 15 years of general technology experience garnered from serving in development, consulting, data science, sales engineering and technical marketing roles. He holds several academic degrees including an MS in Computational Science from George Mason University.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/rick\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Uso do Pydantic para validar documentos JSON com o Couchbase\u00a0","description":"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here's how.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-python-couchbase-capella\/","og_locale":"pt_BR","og_type":"article","og_title":"Using Pydantic to Validate JSON Documents With Couchbase\u00a0","og_description":"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here's how.","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/validate-json-python-couchbase-capella\/","og_site_name":"The Couchbase Blog","article_published_time":"2022-06-30T18:49:17+00:00","article_modified_time":"2025-06-14T04:24:56+00:00","og_image":[{"width":1280,"height":904,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg","type":"image\/jpeg"}],"author":"Rick Jacobs","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rick Jacobs","Est. reading time":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/"},"author":{"name":"Rick Jacobs","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ecb4001e1e4b88a5c44d20c7bf39fcd3"},"headline":"Using Pydantic to Validate JSON Documents With Couchbase\u00a0","datePublished":"2022-06-30T18:49:17+00:00","dateModified":"2025-06-14T04:24:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/"},"wordCount":681,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg","keywords":["JSON","NoSQL Database","pydantic"],"articleSection":["Couchbase Capella","Python","Tools &amp; SDKs"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/","url":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/","name":"Uso do Pydantic para validar documentos JSON com o Couchbase\u00a0","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg","datePublished":"2022-06-30T18:49:17+00:00","dateModified":"2025-06-14T04:24:56+00:00","description":"JSON documents generated by pydantic can be used on Couchbase Capella platform without the concern for ill-formed documents, here's how.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2020\/12\/matrix-356024_1280.jpg","width":1280,"height":904,"caption":"Using SDK's With Couchbase Cloud"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/validate-json-python-couchbase-capella\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Pydantic to Validate JSON Documents With Couchbase\u00a0"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ecb4001e1e4b88a5c44d20c7bf39fcd3","name":"Rick Jacobs","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/398e492dda1c41103d3dfa60dfd80cfe","url":"https:\/\/secure.gravatar.com\/avatar\/4df9d5daa89732e9e520a2ded9e366daf2b32b5aea74313c561073fbc3784be9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4df9d5daa89732e9e520a2ded9e366daf2b32b5aea74313c561073fbc3784be9?s=96&d=mm&r=g","caption":"Rick Jacobs"},"description":"Rick Jacobs is the Technical Product Marketing Manager at Couchbase. His varied background includes experience at many of the world\u2019s leading organizations such as Computer Sciences Corporation, IBM, Cloudera etc. He comes with over 15 years of general technology experience garnered from serving in development, consulting, data science, sales engineering and technical marketing roles. He holds several academic degrees including an MS in Computational Science from George Mason University.","url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/rick\/"}]}},"authors":[{"term_id":9208,"user_id":70772,"is_guest":0,"slug":"rick","display_name":"Rick Jacobs","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/4df9d5daa89732e9e520a2ded9e366daf2b32b5aea74313c561073fbc3784be9?s=96&d=mm&r=g","author_category":"","last_name":"Jacobs","first_name":"Rick","job_title":"","user_url":"","description":"Rick Jacobs \u00e9 o gerente t\u00e9cnico de marketing de produtos da Couchbase.  Seu hist\u00f3rico variado inclui experi\u00eancia em muitas das principais organiza\u00e7\u00f5es do mundo, como Computer Sciences Corporation, IBM, Cloudera etc. Ele tem mais de 15 anos de experi\u00eancia em tecnologia geral, adquirida em fun\u00e7\u00f5es de desenvolvimento, consultoria, ci\u00eancia de dados, engenharia de vendas e marketing t\u00e9cnico.  Ele possui v\u00e1rios diplomas acad\u00eamicos, incluindo um mestrado em Ci\u00eancia da Computa\u00e7\u00e3o pela George Mason University."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/13527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/70772"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=13527"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/13527\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/9965"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=13527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=13527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=13527"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=13527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}