[英]How can I write a regular expression that matches everything between the first and the last quote?
[英]How do I write unencoded Json to my View and emit the first and last quote
我正在使用Google Maps JavaScript API來顯示存儲在SQL Server中的GeoJson數據作為字符串。
我遍歷模型,然后將GeoJson返回到Google腳本,
foreach (var item1 in item.state.Geojsonstates)
{
@:map.data.addGeoJson(@Html.Raw(Json.Encode(@item1.GeoJsonString)));
}
這將返回以下HTML代碼段,
map.data.addGeoJson("{\n\"type\": \"FeatureCollection\",\n\"features
為了使Json有效,我需要發出字符串的第一引號和最后引號,
map.data.addGeoJson(" <-----this quote needs to be emitted
是否有用於的超載器,
Json.Encode())
函數發出報價包裝?
謝謝您的幫助。
我變了
@:map.data.addGeoJson(@Html.Raw(Json.Encode(@item1.GeoJsonString)));
至
@:map.data.addGeoJson(@Html.Raw(@item1.GeoJsonString));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.