美文网首页
Powershell读写JSON文件

Powershell读写JSON文件

作者: 夙小叶 | 来源:发表于2020-01-29 15:17 被阅读0次
ID=62676184
  • 读相关:ConvertFrom-Json
  • 写相关:ConvertTo-Json
# 写入 Json

$Path = "\\VBOXSVR\Public\Docs\config.json"
$data = [pscustomobject]@{
    dirtools = "htp1";
    dir = "htp2"
}

$data | ConvertTo-Json | Set-Content -Path $Path

##################################
{
    "dirtools":  "htp1",
    "dir":  "htp2"
}
# 读取 Json 到 list

$Path = "\\VBOXSVR\Public\Docs\config.json"

function JsonToList($Path)
{
    $op = Get-Content -Path $Path -Raw | ConvertFrom-Json
    $op | ForEach-Object { "{0} - {1}" -f $_.name, $_.url }
}

############################
dirtools - https://dirtools.com
dir - https://dir.com

相关文章

  • Powershell读写JSON文件

    读相关:ConvertFrom-Json 写相关:ConvertTo-Json

  • python中的json

    1、读写文件读写文件主要有json.dump() 与 json.load() 两个函数json.dump()将py...

  • 58. (android开发)Json文件的读写

    Json格式是常见的读写形式。读写Json文件也是常用的操作。这次来实践一下Json文件的读写。首先在SD卡上的读...

  • python request/读写/上传文件

    python 读写文件: data_json = json.dumps(result_r)#json字符串 f =...

  • day09 作业 2018-07-26

    文本文件读写 滚滚长江东逝水   二进制文件读写   json文件读写   姓名灰太狼电话234567[{'nam...

  • python 读写文件,json,目录

    常见的一些json读写的操作读取某个目录下的文件 读取某些json字段 读写文件 读取shell参数,参数下标从1...

  • 技术 | Windows平台上,用Python处理Json文件的

    示例 Windows平台上,用Python处理Json文件在json文件中记录程序的执行次数: 以读写模式打开文件...

  • iOS读写json文件

    一.获取沙盒路径 每个iOS应用都有自己专属的应用沙盒,应用沙盒就是文件系统中的目录。但是iOS系统会将每个应用的...

  • python读写json文件

    将字典保存为本地json文件 从本地json文件读取数据 NOTE : 这里的dump()方法和load方法()没...

  • json 文件的读写

    json文件保存的最小单元应该是一个dictionary,但是在实际储存事是,不一定是直接写入一个dictiona...

网友评论

      本文标题:Powershell读写JSON文件

      本文链接:https://www.haomeiwen.com/subject/mlnvthtx.html