简体   繁体   中英

How to use json-ld in VisualStudio project

The MVC project is written is written in VisualStudio 2013, I'm trying to add the following snippet

<script type="application/ld+json">
{
    "@context": "http://schema.org/",
    "@type": "Vehicle",
...
}

I've also referenced json-ld.net in the solution The problem is, the '@' symbol causes VS2013 to report an error and it won't run on IIS7.5. So I obviously am missing something. Any help is appreciated

After posting above, I tried one last trick and changed it accordingly, it compiles now with out issue and displays without error.

Trick is to escape "@".

<script type="application/ld+json">
{
    "@@context": "http://schema.org/",
    "@@type": "Vehicle",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM