A previous post was made about this around 2 years ago. is there any limit in key and value for hashtables in powershell 5.1?
I am running into a similar issue trying to help a friend who is parsing json returns for books with inconsistent attributes in the json array. I tested converting a sample json file to a hashtable with a function that had been posted. Worked fine, but then I noticed an issue with the values returned.
for example
from Json file
"isbn": "1284057097",
"isbn10": "1284057097",
"binding": "Paperback",
"synopsis": "<p>The Bestselling Microbiology Text for Health Science and Nursing Majors Just Got Better!<br><br>Ideal for health science and nursing students, Fundamentals of Microbiology: Body Systems Edition, Third Edition retains the engaging, student-friendly style and active learning approach for which award-winning author and educator Jeffrey Pommerville is known. Highly suitable for non-science majors, the fully revised and updated third edition of this bestselling text contains new pedagogical elements and an established learning design format that improves comprehension and retention and makes learning more enjoyable. Unlike other texts in the field, Fundamentals of Microbiology: Body Systems Edition takes a global perspective on microbiology and infectious disease, and supports students in self-evaluation and concept absorption. Furthermore, it includes real-life examples to help students understand the significance of a concept and its application in today’s world, whether to their local community or beyond.<br><br>New information pertinent to nursing and health sciences has been added, while many figures and tables have been updated, revised, and/or reorganized for clarity. Comprehensive yet accessible, Fundamentals of Microbiology: Body Systems Edition, Third Edition is an essential text for non-science majors in health science and nursing programs taking an introductory microbiology course.<br><br>Each new print copy includes Navigate 2 Advantage Access that unlocks a comprehensive and interactive eBook, student practice activities and assessments, a full suite of instructor resources, and learning analytics reporting tools.</p>",
would return
when converted to hash table
isbn10 1284057097
isbn 1284057097
binding Paperback
synopsis <p>The Bestselling Microbiology Text for Health Science and Nursing Majors Just Got Better!<br><br>Ideal for health science and nursing students, Fund...
it seemed that every book entry where the synopsis or any other attribute exceeded 166 chars the value would truncate and end with 3 dots. Converting to a hashtable was only a test to find the unique keys within a file as my friend uses a json parser, but the truncation to 166 chars has raised my question.
$jFile "C:psfilesjsonjson_example.json"
$json = (Get-Content $jFile -Raw) | ConvertFrom-Json
$json.books | ConvertTo-HashTable | Out-File -FilePath $File -Force
Stan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.