[Adaptive Card] AdaptiveCard.FromJson() not parsing adaptive card json of version 1.2
See original GitHub issueAdaptive Card V 1.2
What platform is your issue or question related to? (Delete other platforms).
- .NET HTML
- .NET WPF
Author or host
Host
Version of SDK
Adaptive card V 1.2, Nuget AdaptiveCards V 2.1.0, Bot Framework v4
Details
We have setup a QnA service in which in the response I am giving the adaptive card json. And I parse the json in my bot framework code. The adaptive card json was created in V 1.2 from adaptive card designer site and below is my json payload. I am not using template here. Now when i use this json and use it to generate the adaptive card in my bot framework code, it gives me json parsing error.
Below is the piece of code to parse the json. ` string parsedJson = (JObject.Parse(response[0].Answer).ToString(Formatting.None));
AdaptiveCardParseResult result = AdaptiveCard.FromJson(parsedJson);`
I am getting error in AdaptiveCard.FromJson() method.
The error I am facing is below.
Error Message: Current error context error is different to requested error.
Source: Newtonsoft.Json
I further drilled down more in the issue, and found out that there are two properties from JSON which were causing the issue. The properties are horizontalAlignment and verticalAlignment. If I remove this two properties my from json payload , then it parses successfully. This two properties are newly added in v1.2 of adaptive card.
Below is my sample json that i am using. Any help or workaround to render this adaptive card will be appreciated.
{"type":"AdaptiveCard","$schema":"http://adaptivecards.io/schemas/adaptive-card.json","version":"1.2","body":[{"type":"Container","backgroundImage":{"url":"https://hostedimages.blob.core.windows.net/phoenixconstructionimages/phoenixconstructionimages/white%20background.png?st=2020-08-22T07%3A19%3A14Z&se=2030-08-23T07%3A19%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=2dqLkx8NYBtzzG0gLZJs%2BXQIhbgiFylGzY9F883flZI%3D","horizontalAlignment":"Center","verticalAlignment":"Center"},"items":[{"type":"ColumnSet","columns":[{"type":"Column","width":25,"items":[{"type":"Image","url":"https://hostedimages.blob.core.windows.net/phoenixconstructionimages/phoenixconstructionimages/bluebeam%20bot%20icon.png?st=2020-08-22T07%3A06%3A38Z&se=2032-08-23T07%3A06%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=XaTaJ3X8FPvoLXTEgw16hkVR4CWH5Zo7RsK9MB6iFqc%3D","spacing":"Small"}],"verticalContentAlignment":"Center","backgroundImage":{"horizontalAlignment":"Center","verticalAlignment":"Center"}},{"type":"Column","width":75,"items":[{"type":"TextBlock","text":"BLUEBEAM REVU ","fontType":"Default","size":"ExtraLarge","weight":"Bolder","color":"Accent"},{"type":"TextBlock","text":"Quick - Tip Topics","fontType":"Default","size":"Large","color":"Accent"}],"verticalContentAlignment":"Center","backgroundImage":{"horizontalAlignment":"Center","verticalAlignment":"Center"}}]},{"type":"Container","items":[{"type":"ColumnSet","columns":[{"type":"Column","width":"stretch","items":[{"type":"TextBlock","text":"Generate a Summary Report:","size":"Large","color":"Accent","weight":"Bolder","spacing":"Medium","wrap":true,"id":"topic_title"}],"spacing":"Medium"}]}],"separator":true,"spacing":"Medium"},{"type":"TextBlock","text":"A markup summary is a way to publish a report of all of the markups, including any [embedded images or videos](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Unsorted/Capture--MV.htm), from one or more PDFs, making it much simpler to communicate and manipulate data important to large projects. The summary can be sent to a printer, a CSV or XML file that can be opened in Excel and other third-party programs, or appended to the end of the PDF. A summary differs from exporting markups primarily because the data contained in the summary is formatted so that it can be read by other programs.","wrap":true},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"CLICK HERE TO TOGGLE DETAILED INSTRUCTIONS","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"1. From the [Markups list toolbar](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Markups/Markups-List--MTV.htm#Markups_List_Toolbar), click **Summary** and select the desired output type (CSV, XML, PDF, or Print). The **Markups Summary** dialog box appears.\n - This same menu is available from the [Thumbnails panel](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Thumbnails/Thumbnails-Tab--MTV.htm). Go to **Thumbnails** > **Markup Summary** and select the output type.\n - Alternatively, go to **Batch** > **Summary**. This will default to the CSV output type, but this selection can be changed in the **Export as** menu later.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Dialog%20Boxes/Markup-Summary_PDF.png"},{"type":"TextBlock","text":"2. To work with a previously saved batch of PDFs, click **Load** and select the desired batch file.\n3. By default, the PDF that is currently active is automatically included in the summary. To include additional files, select one of the following options from the **Add** menu:\n - **Add Files**: Adds individual files from a network or local drive. Selecting this option will cause the **Open** dialog box to appear. Navigate to the appropriate location and select the desired files.\n - **Add Open Files**: Adds all files currently open in Revu.\n - **Add Folder**: Adds all files in a selected folder on a network or local drive, but not files contained in subfolders. Selecting this option will cause the **Select Folder** dialog box to appear. Navigate to the desired folder and select it.\n - **Add Folder (including subfolders)**: Adds all files in a selected folder on a network or local drive as well as all files within any of its subfolders. Selecting this option will cause the **Select Folder** dialog box to appear. Navigate to the desired folder and select it.\n - **Add Current Set**: Adds all files contained in the current Set.\n4. To remove a file from the list, select it and click **Remove**.\n5. To save this batch of files for later use, click **Save**.\n6. Click the **Columns** tab.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Dialog%20Boxes/Markup-Summary_Columns-tab.png"},{"type":"TextBlock","text":"7. Select the markup data that should be included in this summary report from the list.\n - If you would prefer to use a previously saved configuration, click **Load Config** and select the desired configuration.\n - Columns that do not contain markup data currently will also be missing. Enable **Show Empty Columns** to include them. This allows users who are creating a summary early in the life of a project to include all the columns they know they will eventually need and thus maintain a consistent report format throughout the life of the project.\n8. To change the position of a particular piece of markup data in the report, drag and drop it into the desired position.\n - This is only going to affect the order in which the data is presented, not the order in which it is sorted. For example, you might want File Name to be the first piece of information in the report, but also want to sort by Subject. In that case, you would move File Name to the top of the list here. Sort order is determined later in the process.\n - Also, please note that you will have the opportunity to create separate reports based on whatever markup data is at the top of the list, so if that is desired, be sure to move the necessary data element to the top.\n9. Click the **Filter and Sort** tab.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Dialog%20Boxes/Markup-Summary_Filter-Sort-tab.png"},{"type":"TextBlock","text":"10. To filter markup information, click the associated entry in the **Filter** column (by default, they are all set your preexisting [Markups list filters] or, if no filters were applied beforehand, to [All]) and select the items that should appear in the report. This allows the summary to be filtered so you only see, for example, issues in a particular Space or Markups from a particular author or something similar, allowing you to get the report you want without requiring the summary to create redundant line items.\n - To filter by data that is not being included in the summary, select Show All Columns.\n11. To sort the information that appears on the report, choose one or more sort options, starting with Sort by. All subsequent sort options will be labeled Then by and a new one will appear anytime one is set. Choose whether to sort each selection in Ascending or Descending order from the associated menu.\n12. Click the Output tab.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Dialog%20Boxes/Markup-Summary_PDF.png"},{"type":"TextBlock","text":"13. Select the desired format for the summary report from the **Export as** menu. This selection will change some of the output options shown.\n - If the summary report was initiated from the [Markups list](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Markups/Markups-List--MTV.htm) or the [Thumbnails panel](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Thumbnails/Thumbnails-Tab--MTV.htm), this will match the selection made then. If it was initiated from the [Batch menu](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Batch/Batch-Menu.htm), it will be set to CSV. In any case, it can be changed at any time.\n14. To automatically open the report after it has been created, select **Open File After Creation** (does not apply if **Export as** is set to **Print**).\n15. To overwrite any existing files with the same name in the save location, select **Overwrite Existing Files** (does not apply if **Export as** is set to **Print**).\n16. Confirm that the location in the **Export to** field is acceptable. To change it, click **Change** and select the desired folder (does not apply if **Export** as is set to **Print**).\n17. Change the **Title**, if desired. The name of the summary file will be based on this information.\n18. To add the current date to the end of the **Title**, select **Append Date to Title**.\n19. To create separate reports based on the primary sort data (that is, the data at the top of the list on the previous screen), select **Create Multiple Reports Per [data]** (does not apply if **Export as** is set to **Print**).\n20. Other options vary by **Export as** file type. Set them accordingly:","wrap":true},{"type":"ColumnSet","columns":[{"type":"Column","width":"stretch"},{"type":"Column","width":50,"items":[{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"CSV Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"**Include**: Select the type of data to include in the report:\n- **Markups**: Includes just markup data.\n- **Totals**: Includes just the totals calculated by the current sort column in the Markups list.\n- **Markups & Totals**: Includes both markup data and sort totals calculated by the current sort column in the Markups list.\n\n**Column Headers**: Select this option to add a row to the top of the CSV that contains the column names from the Markups list.\n\n**ID Columns**: Select this option to add columns for ID and Parent to the CSV. This is particularly useful for grouped markups, which will have their parent markup specified in the Parent column.\n\n**Measurement Units**: Select this option to add columns for the units of measure next to measurement data included in the summary.\n\n**Format Numbers**: Select this option to preserve the number formatting of custom columns included in the report. When left unchecked, the numbers in these columns will still be included in the report, but they will be unformatted.\n\n**Replies**: Select this option to include replies from the Markups list in the summary report.","wrap":true}]}}]},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"XML Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"**Include**: Select the type of data to include in the report:\n- **Markups**: Includes just markup data.\n- **Totals**: Includes just the totals calculated by the current sort column in the Markups list.\n- **Markups & Totals**: Includes both markup data and sort totals calculated by the current sort column in the Markups list.\n\n**Measurement Units**: Select this option to add columns for the units of measure next to measurement data included in the summary.\n\n**Format Numbers**: Select this option to preserve the number formatting of custom columns included in the report. When left unchecked, the numbers in these columns will still be included in the report, but they will be unformatted.\n\n**Replies**: Select this option to include [replies from the Markups list](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Markups/Markups-List--MTV.htm#Context_Menu) in the summary report.","wrap":true}]}}]},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"PDF Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"**Append and Hyperlink to Current PDF**: Select this option to append the summary to the current PDF and include hyperlinks to the original markups.\n\n**Template**: Use this option to select a PDF report template on which to generate your report. New PDF templates can be imported using the **Import** button. Once a PDF template is imported, it will appear in the **Template** list until it is deleted using the **Remove** button.\n- Click **Edit** to redefine the report area on the PDF template.\n\n**Insert Page Break per**: Select this option to create page breaks according to the data selected in the associated menu.\n\n**Create Spaces Cover Sheet**: Select this option to include a cover sheet containing a large representation of the Space referenced before each page break. Only available when Insert Page Break per is set to **Space**.\n\n**Style**: Choose Table or Flow.\n- **Flow**: In this summary style, markups are summarized one at a time, with a report-style block of information.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Examples/summary-flow-report.png"},{"type":"TextBlock","text":"**Table**: In this summary style, markups are summarized in a tabular format to more closely mimic the look of the Markups list itself.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Examples/summary-table-report.png"},{"type":"TextBlock","text":"**Thumbnail**: Select the size of the thumbnail image for each markup shown in the summary. The thumbnail includes the markup appearance as well as the underlying PDF content (if **Include Page Content** is selected) in the region of the PDF where the markup is located.\n\n**Include Page Content**: Select this option to include the underlying PDF content as part of the preview area in the summary. When left unchecked, only the markup is included. Enabling this option can add to the time it takes to generate the summary significantly so if you don't need it or if your summary is taking a very long time to generate, leave it disabled.\n\n**Padding**: Enter the amount of surrounding context shown around the preview image included in the Markup Summary. Setting a higher value provides more surrounding context.","wrap":true},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"Other Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"Click **Options** to set any of the following:\n\n**Page Size**: Select the page size and orientation (**Portrait** or **Landscape**) of the PDF output.\n\n**Include Totals**: Select this option to include the totals calculated by the current sort column in the Markups list on the report. This is particularly useful for easy subtotaling by subject or subcontractor.\n\n**Include Absolute Hyperlinks**: Select this option to include an absolute path hyperlink with each markup in the summary report that links to the markup's page in the source document.\n\n**Include Capture Media Addendum**: Select this option to include larger views of all images and videos embedded with [Capture](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Unsorted/Capture--MV.htm) as an addendum to the report. This is useful when the thumbnails allowed on the summary page are too small to be effective (which is common when there are multiple images or videos embedded in one or more markups).\n\n**Attach Media as Linked Files**: Select this option to attach images and videos embedded with [Capture](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Unsorted/Capture--MV.htm) to the summary report as linked files. Clicking on a preview image in the Capture Media Addendum will open the image or video in the device's default viewer.\nThis option is only available when **Include Capture Media Addendum** is selected.\n\n**Replies**: Select this option to include [replies from the Markups list](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Markups/Markups-List--MTV.htm#Context_Menu) in the summary report.","wrap":true}]}}]}]}}]},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"Print Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"**Template**: Use this option to select a PDF report template on which to generate your report. New PDF templates can be imported using the **Import** button. Once a PDF template is imported, it will appear in the Template list until it is deleted using the **Remove** button.\n\nClick **Edit** to redefine the report area on the PDF template.\nInsert Page Break per: Select this option to create page breaks according to the data selected in the associated menu.\n\n**Create Spaces Cover Sheet**: Select this option to include a cover sheet containing a large representation of the Space referenced before each page break. Only available when **Insert Page Break** per is set to **Space**.\n\n**Style**: Choose **Table** or **Flow**.\n- **Flow**: In this summary style, markups are summarized one at a time, with a report-style block of information.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Examples/summary-flow-report.png"},{"type":"TextBlock","text":"**Table**: In this summary style, markups are summarized in a tabular format to more closely mimic the look of the Markups list itself.","wrap":true},{"type":"Image","url":"https://support.bluebeam.com/online-help/revu20/Content/Resources/Images/Examples/summary-table-report.png"},{"type":"TextBlock","text":"**Thumbnail**: Select the size of the thumbnail image for each markup shown in the summary. The thumbnail includes the markup appearance as well as the underlying PDF content (if **Include Page Content** is selected) in the region of the PDF where the markup is located.\n\n**Include Page Content**: Select this option to include the underlying PDF content as part of the preview area in the summary. When left unchecked, only the markup is included. Enabling this option can add to the time it takes to generate the summary significantly so if you don't need it or if your summary is taking a very long time to generate, leave it disabled.\n\n**Padding**: Enter the amount of surrounding context shown around the preview image included in the Markup Summary. Setting a higher value provides more surrounding context.","wrap":true},{"type":"ActionSet","actions":[{"type":"Action.ShowCard","title":"Other Options","card":{"type":"AdaptiveCard","body":[{"type":"TextBlock","text":"Click **Options** to set any of the following:\n\n**Page Size**: Select the page size and orientation (**Portrait** or **Landscape**) of the PDF output.\n\n**Include Totals**: Select this option to include the totals calculated by the current sort column in the Markups list on the report. This is particularly useful for easy subtotaling by subject or subcontractor.\n\n**Include Absolute Hyperlinks**: Select this option to include an absolute path hyperlink with each markup in the summary report that links to the markup's page in the source document.\n\n**Include Capture Media Addendum**: Select this option to include larger views of all images and videos embedded with [Capture](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Unsorted/Capture--MV.htm) as an addendum to the report. This is useful when the thumbnails allowed on the summary page are too small to be effective (which is common when there are multiple images or videos embedded in one or more markups).\n\n**Replies**: Select this option to include [replies from the Markups list](https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Window/Panels/Markups/Markups-List--MTV.htm#Context_Menu) in the summary report.","wrap":true}]}}]}]}}]}]}]},{"type":"TextBlock","text":"21. To save the configuration, click **Save Config**.\n22. Click **OK**. The report is generated.","wrap":true}]},"style":"positive"}]},{"type":"ActionSet","actions":[{"type":"Action.OpenUrl","title":"More About Markup Summary","url":"https://support.bluebeam.com/online-help/revu20/Content/RevuHelp/Menus/Batch/Summary/Batch-Summary--MT.htm","style":"positive","iconUrl":"https://hostedimages.blob.core.windows.net/bluebeamapp/ADAPTIVE%20CARDS/HOSTED%20IMAGES/Bluebeam%20Round%20Logo%20White.png?st=2020-08-22T18%3A07%3A01Z&se=2027-08-23T18%3A07%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=mx6CnjVU%2BOVNTaG0RXdL%2Fb1FRRc3u%2B2Pbq%2F1cC1lnn0%3D"}]}],"horizontalAlignment":"Center"}],"backgroundImage":{"url":"https://hostedimages.blob.core.windows.net/bluebeamapp/ADAPTIVE%20CARDS/HOSTED%20IMAGES/BLUEBEAM%20BACKGROUND%20IMAGE.png?st=2020-08-22T07%3A16%3A37Z&se=2048-08-23T07%3A16%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=T5vjj0LrAeQPv1vawTFPymxnBpEfmHmUQOJ9cbTianQ%3D"}}
Explain your issue. If you just have a question, please post on StackOverflow instead.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
@SunilsingRana This behavior is due to the fact that the card has two required properties are missing. Could you please check with the background images, and they have URL?
We are going to make changes to the parsing unrelated to this issue, and the changes will allow cards to render even if the required properties are missed more than twice. Here is the screenshot of the change. The change will be part of our next patch release scheduled for the end of this month.
@jwoo-msft go ahead and reference the specific issue/PR here for context to allow for eventual dup’ing here once @SunilsingRana gets back on this one!
Thanks!