Skip to content

Textract : Parsing aws_sdk_textract analyze document response #806

Answered by harssh
harssh asked this question in Q&A
Discussion options

You must be logged in to vote

Created below struct following https://ectobit.com/blog/parsing-json-in-rust/

If I could iterate through the response I think I can get some proper JSON output.

pub type TexResponse = Vec<TexAnalyzeDocumentOutput>;

pub type BlockResponse = Vec<Block>;

#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TexAnalyzeDocumentOutput {
    #[serde(rename = "DocumentMetadata")]
    pub document_metadata: DocumentMetadata,
    #[serde(rename = "Blocks")]
    pub blocks: Vec<Block>,  
    #[serde(rename = "AnalyzeDocumentModelVersion")]
    pub analyze_document_model_version: String,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@harssh
Comment options

Comment options

You must be logged in to vote
1 reply
@Velfi
Comment options

Answer selected by jmklix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants