問題
程式要要透過 string.Format 的方式來改變 json 字串的內容。
結果發生了 Input string was not in a correct format 的錯誤
解法
因為 string.Format 會看字串中的 {} 所以 json 就會遇到了問題。
原本的程式如下,
1 | var tempStr = @"{ |
那怎麼解呢?
就是重覆 { or } ,
所以調整後的程式如下,
1 | var tempStr = @"{{ |
Hello! 我是 RM
程式要要透過 string.Format 的方式來改變 json 字串的內容。
結果發生了 Input string was not in a correct format 的錯誤
因為 string.Format 會看字串中的 {} 所以 json 就會遇到了問題。
原本的程式如下,
1 | var tempStr = @"{ |
那怎麼解呢?
就是重覆 { or } ,
所以調整後的程式如下,
1 | var tempStr = @"{{ |
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true